if Gson instance is obtained from GsonBuilder with pretty print
GsonBuilder builder = new GsonBuilder();
builder.setPrettyPrinting();
Gson gson = builder.create();
it would produce un-parseable json string if the object contains an empty map
example:
{"viewsStale":true,"fireAllRules":0,"formRules":[],"dcs":[{"accountId":1,
"createdBy":"","name":"dc1","m_segmentGroup":{"accountId":1,
"nextRuleId":0,"name":"dc1","createdBy":"","rules":{}"description":
"desc"},"m_dcmTexts":{}}],"dispatchableName":"disp1","typeCode":-1,
"subType":"GENERIC","name":"disp1","status":"A"}
notice missing comma here ("rules":{}"description":)
correct output without pretty print
{"viewsStale":true,"fireAllRules":0,"formRules":[],"dcs":[{"accountId":1,"create
dBy":"","name":"dc1","m_segmentGroup":{"accountId":1,"nextRuleId":0,"name":"dc1"
,"createdBy":"","rules":{},"description":"desc"},"m_dcmTexts":{}}],"dispatchable
Name":"disp1","typeCode":-1,"subType":"GENERIC","name":"disp1","status":"A"}
What version of the product are you using? On what operating system?
latest product. java: 1.6, os: xp
Please provide any additional information below.
Original issue reported on code.google.com by jackwum...@gmail.com on 2 Sep 2009 at 9:13
Original issue reported on code.google.com by
jackwum...@gmail.com
on 2 Sep 2009 at 9:13