Hi Jiro,=0AThe answer lies in the type you are using for your property, whi=
ch I'm assuming=0Aits String. Because the JSON spec forbids null to be assi=
gned to a String, an=0Aempty one is used if null value is encountered. The =
following types allow null=0Ato be assigned as you expect: Object, Map, and=
any bean class. =0A=0AExample:=0Aclass MyBean {=0A private Object anO=
bject;=0A private String anString;=0A // getters & setters=0A}=0A=
=0AMyBean bean =3D new MyBean();=0AJSON json =3D JSONObject.fromObject( bea=
n );=0ASystem.err.println( json.toString( 2 ) );=0A=0Aprints:=0A{=0A "anSt=
ring": "",=0A "anObject": null=0A}=0A =0ACheers,=0AAndres=0A=0A-----------=
--------------------------------=0Ahttp://jroller.com/page/aalmiray=0Ahttp:=
//www.linkedin.com/in/aalmiray=0A--=0AWhat goes up, must come down. Ask any=
system administrator.=0AThere are 10 types of people in the world: Those w=
ho understand binary, and those who don't.=0ATo understand recursion, w=
e must first understand recursion.=0A=0A----- Mensaje original ----=0ADe: J=
iro Iwamoto <iw...@sy...>=0APara: jso...@li...urc=
eforge.net=0AEnviado: lunes, 14 de mayo, 2007 3:12:57=0AAsunto: [json-lib-u=
ser] JSONObject.fromBean(bean) cannot describe null=0A=0AHello.=0A=0AI inte=
nd to transform bean into json using JSONObject.fromBean(bean).=0AThe prope=
rty of bean include null value like below=0A=0Abean.setHoge(null);=0A=0AI e=
xpect json below=0A{"hoge": null}=0A=0Abut result is=0A{"hoge": ""}=0A=0Ais=
this bug?=0A=0APlease teach it.=0A=0AJiro=0A=0A-- =0AJiro Iwamoto <iwamoto=
@sysrdc.ns-sol.co.jp>=0A=0A------------------------------------------------=
-------------------------=0AThis SF.net email is sponsored by DB2 Express=
=0ADownload DB2 Express C - the FREE version of DB2 express and take=0Acont=
rol of your XML. No limits. Just data. Click to get it now.=0Ahttp://source=
forge.net/powerbar/db2/=0A_______________________________________________=
=0Ajson-lib-user mailing list=0Aj...@li...=0Ahttps=
://lists.sourceforge.net/lists/listinfo/json-lib-user=0A=0A=0A=0A=0A=0A=0A=
=0A=09=0A=09=0A=09=09=0A___________________________________________________=
________ =0ADo You Yahoo!? =0ALa mejor conexi=F3n a Internet y <b >2GB</b> =
extra a tu correo por $100 al mes. http://net.yahoo.com.mx =0A |