[fpc-devel] JSON Beautifier

theo xpde at theo.ch
Wed Oct 13 00:58:18 CEST 2010


Thank you Michael, great!

There is one little problem: the right square bracket which is closing 
an array always goes to the first position (no indentation).
And it's a matter of taste, if brackets and parenthesis should go to the 
same line.
I've attached an example.  The FormatJSON output (above) and the 
NetBeans Formatter output (below).

Thanks
Theo

-------------------------------------------
{
  "i_width" : 1280,
  "i_height" : 1024,
  "layouts" : [
    {
      "s_name" : "Unbenannt_1",
      "i_duration" : 3000,
      "t_starttime" : "null",
      "t_endtime" : "null",
      "t_startdate" : "null",
      "t_enddate" : "null",
      "i_dayofweek" : 0,
      "i_timetype" : 0,
      "frames" : [
        {
          "s_name" : "Unbenannt",
          "i_top" : 10,
          "i_left" : 200,
          "i_width" : 200,
          "i_height" : 200,
          "texts" : [
            {
              "s_url" : "test.php",
              "i_contenttype" : 1,
              "s_html" : "{0D1FB698-709D-4817-9F76-34E8960CE4F2}",
              "s_name" : "Unbenannt",
              "i_duration" : 5000,
              "t_starttime" : "null",
              "t_endtime" : "null",
              "t_startdate" : "null",
              "t_enddate" : "null",
              "i_timetype" : 0,
              "i_dayofweek" : 0
            }
]
        }
]
    }
]
}


-------------------------------------------

{
    "i_width" : 1280,
    "i_height" : 1024,
    "layouts" : [{
        "s_name" : "Unbenannt_1",
        "i_duration" : 3000,
        "t_starttime" : "null",
        "t_endtime" : "null",
        "t_startdate" : "null",
        "t_enddate" : "null",
        "i_dayofweek" : 0,
        "i_timetype" : 0,
        "frames" : [{
            "s_name" : "Unbenannt",
            "i_top" : 10,
            "i_left" : 200,
            "i_width" : 200,
            "i_height" : 200,
            "texts" : [{
                "s_url" : "test.php",
                "i_contenttype" : 1,
                "s_html" : "{E52CD0B2-E4C1-4C7E-96FA-9C9E1275DAC8}",
                "s_name" : "Unbenannt",
                "i_duration" : 5000,
                "t_starttime" : "null",
                "t_endtime" : "null",
                "t_startdate" : "null",
                "t_enddate" : "null",
                "i_timetype" : 0,
                "i_dayofweek" : 0
            }]
        }]
    }]
}





More information about the fpc-devel mailing list