How to output formated JSON from a JSONObject

JSONObject jo = new JSONObject();
.....
ObjectMapper mapper = new ObjectMapper();
Object json = mapper.readValue(jo.toString(), Object.class);
System.out.println("var data = " + mapper.writerWithDefaultPrettyPrinter().writeValueAsString(json) + ";");

No comments:

Post a Comment

Why BQ28Z610 function Current() returns 0 mA

Fixing 0 mA Current Readings on the BQ28Z610 Device Custom driver for the BQ28Z610 device was connected directly via I2C. It is p...