| Issue 153: | setPrettyPrinting cause missing comma deliminator after an empty map | |
| 2 people starred this issue and may be notified of changes. | Back to list |
Sign in to add a comment
|
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,"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"}
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.
|
||||||||||||
,
Sep 29, 2009
Fixed in r454
Status: Fixed
Labels: Milestone-Release1.4 |
|||||||||||||
| ► Sign in to add a comment | |||||||||||||