EF.JSON
Support for reading and writing data in JSON format.
<seealso href="http://www.json.org/"> JSON web site </seealso>
Routines
function PairsToJSON(const APairs: TEFPairs;Builds a JSON representation of the pairs.
Example: Param1='Foo', Param2=20
Result: '["Param1", "Foo"], ["Param2", "20"]'
Set AReversed to True to switch keys and values.
function TriplesToJSON(const ATriples: TEFTriples): string;Builds a JSON representation of the triples.
Example: A B C, One Two Three
Result: '["A", "B", "C"], ["One", "Two", '"Three"]'
function DataSetToJSON(const ADBConnection: TEFDBConnection;Builds a JSON representation of a dataset's fields values. Creates the dataset by executing the specified command text against the specified DB connection. Each record is enclosed in []s and each value is double-quoted.
<para><c>'["IT", "ITALY"], ["UK", "UNITED KINGDOM"]'</c></para>function DataSetToJSON(const ADataSet: TDataSet;Builds a JSON representation of a dataset's fields values. Each record is enclosed in []s and each value is double-quoted.
<para><c>'["IT", "ITALY"], ["UK", "UNITED KINGDOM"]'</c></para>function QuoteJSONStr(const AString: string): string;Wraps the string in double quotes, escaping any embedded double quotes.
function QuoteJSONValue(const AString: string): string;Escapes special characters and wraps the string in double quotes, producing a valid JSON string value.
function JSONNullToEmptyStr(const AJSONValue: string): string;Returns '' when AJSONValue is the JSON literal 'null', otherwise returns AJSONValue unchanged.
function JSONEscape(const AString: string): string;Escapes control characters in the JSON string.
procedure LoadJSONObjectInTree(const AJSONObject: TJSONObject;Adds to ATree all pairs in AJSONObject, recursively. All values are treated as strings. Arrays are not supported. If a JSON array is found, an exception is raised.
