[json-lib-user] JSONObject.toBean() in a Object with an Array Property
Brought to you by:
aalmiray
From: Everton A. <ton...@gm...> - 2010-11-18 15:17:19
|
Hi! I need to convert this JSON string {"Name":"Apple","Expiry":"\/Date(1230429600000-0200)\/","Price":3.99,"Sizes":["Small","Medium","Large"]} To this JavaBean public class Product { private String name; private Date expiry; private BigDecimal price; private String[] sizes; } With this code JSONObject json = JSONObject.fromObject(jsonText); Product p = (Product) JSONObject.toBean(json, Product.class); And I'm getting this exception: Exception in thread "main" net.sf.json.JSONException: java.lang.NoSuchMethodException: Unknown property 'Sizes' on class 'class Product' I don't think it's because os case sensitivity (it's an Object created on C#, that's why the properties are Pascal Case). What do i need to do to make this work? I searched for it and got nothing... Thanks! _______________________ Everton Agner Ramos |