javascriptjsonprettify

What is meant by to prettify JSON


I have heard of sites that prettify/beautify JSON. What does it actually mean?


Solution

  • This means a more human readable version of it. E.g. the following is valid json, but not well readable:

    {"outcome" : "success", "result" : {"name" : "messaging-sockets", "default-interface" : "external", "include" : [], "socket-binding" : {"messaging" : {"name" : "messaging", "interface" : null, "port" : 5445, "fixed-port" : null, "multicast-address" : null, "multicast-port" : null}, "messaging-throughput" : {"name" : "messaging-throughput", "interface" : null, "port" : 5455, "fixed-port" : null, "multicast-address" : null, "multicast-port" : null}}}, "compensating-operation" : null}
    

    After prettyfying this could look like this:

    {
       "outcome":"success",
       "result":{
          "name":"messaging-sockets",
          "default-interface":"external",
          "include":[
    
          ],
          "socket-binding":{
             "messaging":{
                "name":"messaging",
                "interface":null,
                "port":5445,
                "fixed-port":null,
                "multicast-address":null,
                "multicast-port":null
             },
             "messaging-throughput":{
                "name":"messaging-throughput",
                "interface":null,
                "port":5455,
                "fixed-port":null,
                "multicast-address":null,
                "multicast-port":null
             }
          }
       },
       "compensating-operation":null
    }