Print JSON with "pretty" (indented) format
delphi, json
Solution
`TJSONObject` does not support pretty printing.
Other JSON libraries do. For instance SuperObject, as discussed here: How do I pretty-print JSON in Delphi?
Problem
If I create a JSON object and print it on the console: ``` LJSONObject:= TJSONObject.Create; LJSONObject.AddPair(TJSONPair.Create(TJSONString.Create('Hello'), TJSONString.Create('World'))); LJSONObject.AddPair(TJSONPair.Create(TJSONString.Create('Ciao'), TJSONString.Create('Mondo'))); Writeln(LJSONObject.ToString); ``` the result is: ``` {"Hello":"World", "Ciao":"Mondo"} ``` How I can print the result with nicer indentation, like this? ``` { "Hello":"World", "Ciao":"MOndo" } ```