System.JSON.TJSONAncestor.ToJSON
Delphi
function ToJSON(Options: TJSONOutputOptions): string; overload;
function ToJSON: string; overload; inline;
C++
System::UnicodeString __fastcall ToJSON(TJSONOutputOptions Options)/* overload */;
System::UnicodeString __fastcall ToJSON()/* overload */;
Properties
Type | Visibility | Source | Unit | Parent |
---|---|---|---|---|
function | public | System.JSON.pas System.JSON.hpp |
System.JSON | TJSONAncestor |
Description
Returns the string representation of the JSON object.
There are two overloaded methods:
- The function
ToJSON(Options: TJSONOutputOptions): string:
returns the string representation of the JSON object.
- Characters may be encoded using
"\uNNNN"
format whenOptions
include:
EncodeAbove127
- non-ASCII characters (above ASCII 127) are encoded
EncodeBelow32
- low ASCII characters (below ASCII 32) are encoded
- Special characters like a quote, backslash, tab, new-line, line-feed, etc., are encoded using the
"\C"
format.
- The function
ToJSON: string; overload;
returns the string representation of the JSON object.
- Non-ASCII characters (above ASCII 127) and low ASCII characters (below ASCII 32) are encoded using the
"\uNNNN"
format.
- Special characters like a quote, backslash, tab, new-line, line-feed, etc., are encoded using the
"\C"
format.
The string returned by .ToJSON
is more useful for transport purposes because it contains only ASCII characters. All low-ASCII characters and extended characters in UTF-8 sequences are encoded as printable ASCII characters.
The string is double-quoted.