Navigation Menu

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

setPrettyPrinting cause missing comma deliminator after an empty map #153

Closed
GoogleCodeExporter opened this issue Mar 19, 2015 · 1 comment

Comments

@GoogleCodeExporter
Copy link

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

@GoogleCodeExporter
Copy link
Author

Fixed in r454

Original comment by inder123 on 29 Sep 2009 at 5:53

  • Changed state: Fixed
  • Added labels: Milestone-Release1.4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant