[fpc-devel] JSON Beautifier

Michael Van Canneyt michael at freepascal.org
Tue Oct 12 23:15:25 CEST 2010


Hello,

Just a short follow-up, to say that I've committed support (a bit later than
planned) for FormatJSON() which has several options. Revision 16146.

Function FormatJSON(Options : TFormatOptions = DefaultFormat; Indentsize : Integer = DefaultIndentSize) : TJSONStringType;

Options:

   TFormatOption = (foSingleLineArray,   // Array without CR/LF : all on one line
                    foSingleLineObject,  // Object without CR/LF : all on one line
                    foDoNotQuoteMembers, // Do not quote object member names.
                    foUseTabchar);       // Use tab characters instead of spaces.
   TFormatOptions = set of TFormatOption;

And defaults:

Const
   DefaultIndentSize = 2;
   DefaultFormat     = [];
   AsJSONFormat      = [foSingleLineArray,foSingleLineObject]; // These options make FormatJSON behave as AsJSON

If need be, more options can be added. But the above seem like the logical ones.

Michael.



On Fri, 24 Sep 2010, theo wrote:

>>> / Any idea when this feature will be ready?
> /> Somewhere next week.
>
> Great.
>
>
>> myJSONObject['testdate']:=TJSONDate.Create('2010/11/10');
>
>
> I see. Thank you
>
> Regards
> Theo
>
>
>
> _______________________________________________
> fpc-devel maillist  -  fpc-devel at lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-devel
>



More information about the fpc-devel mailing list