Am 28.01.2014 12:29, schrieb luciano de souza:
Hello all,

JSON is a very easy format to handle with Freepascal. However, the
output is not so readable when the number of registers increase. An
example of it is:
[snip]
s.text := r.AsJson;
s.SavetoFile('test.txt');
[snip]
The corresponding output is:

{ "people" : [{ "name" : "Luciano de Souza", "age" : 38, "city" :
"NiterĂ³i", "country" : "Brazil" }, { "name" : "Mariella Molinari",
"age" : 29, "city" : "Padova", "country" : "Italy" }] }

My question is: is there a way to automatically format it? Breaking
lines? Becoming easy the reading?
TJSONData.AsJSON basically uses the format options "foSingleLineArray, foSingleLineObject" (it's not implemented that way though, put it appears like this ^^). To manually influence this you should take a look at TJSONData.FormatJSON.

Regards,
Sven
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to