Thursday, 29 August 2013

JSON formatter in Pascal / Delphi

JSON formatter in Pascal / Delphi

I am looking for a function that will take a string of Json as input and
format it with line breaks and indentations (tabs).
Example: I have input a line:
{"menu": {"header": "JSON", "items": [{"id": "Delphi"},{"id": Pascal",
"label": "Nice tree format}, null]}}
And want to get this:
{
"menu":{
"header":"JSON",
"items":[
{
"id":"Delphi"
},
{
"id":"Pascal",
"label":"Nice tree format"
},
null
]
}
}
I found a lot of examples for PHP and C#, but not for Delphi. Could
someone help with such a function?

No comments:

Post a Comment