KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
This is the JSON string I have: {"attributes":[{"nm":"ACCOUNT","lv":[{"v":{"Id":null,"State":null},"vt":"java.util.Map","cn":1}],"vt":"java.util.Map","status":"SUCCESS","lmd":13585},{"nm":"PROFILE","lv":[{"v":{"Party":null,"Ads":null},"vt":"java.util.Map","cn":2}],"vt":"java.util.Map","status":"SUCCESS","lmd":41962}]} I need to convert the above JSON String into Pretty Print JSON Output (using Jackson), like below: { "attributes": [ { "nm": "ACCOUNT", "lv": [ { "v": { "Id": null, "State": null }, "vt": "java.util.Map", "cn": 1 } ], "vt": "java.util.Map", "status": "SUCCESS", "lmd": 13585 }, { "nm": "PROFILE "lv": [ { "v": { "Party": null, "Ads": null }, "vt": "java.util.Map", "cn": 2 } ], "vt": "java.util.Map", "status": "SUCCESS", "lmd": 41962 } ] } Can anyone provide me an example based on my example above? How to achieve this scenario? I know there are lot of examples, but I am not able to understand those properly. Any help will be appreciated with a simple example. Updated: Below is the code I am using: ObjectMapper mapper = new ObjectMapper(); System.out.println(mapper.defaultPrettyPrintingWriter().writeValueAsString(jsonString)); But this doesn't works with the way I needed the output as mentioned above. Here's is the POJO I am using for the above JSON: public class UrlInfo implements Serializ
Tags (comma-separated)
Save Edits
Cancel