Posted In: JSON

Convert json string to pretty print json output using JSON library

    1. Example will use following Test data   2. Using GSON.toJson   3. Using Jackson 2X writerWithDefaultPrettyPrinter   4. Using Jackson 1X writerWithDefaultPrettyPrinter   5. Using org.json.JSONObject.toString(indent) from org.json library   6. Using net.sf.json.JSONObject.toString(indent) from net.sf.json-lib library   7. Output { “portfolio” : [ { “stock” : “Infosys”, “quantity” : “100”, “buy” : […]

Read More

Tags: , , , , ,

by , on February 26th, 2017

  • Categories