[json-lib-user] Default values when converting from Java beans to JSON objects
Brought to you by:
aalmiray
|
From: Florian S. <flo...@gm...> - 2007-07-05 15:07:12
|
Hi Andres,
I have the following Java bean class:
public class MyBean {
private Integer myInt;
private String myString;
public MyBean(){
this.myInt = null;
this.myString = null;
}
//getters & setters
}
When I try to convert this bean into a JSON object using
JSONObject.fromBean( new MyBean() )
I get { "myInt": 0, "myString": "" } instead of what I would
expect, namely { "myInt": null, "myString": null }.
Is there a way to get the second JSONObject, which is
what I intuitively expect?
Thanks in advance,
Florian
|