Converts JSON data to a TValue record
Source position: fpjsonvalue.pp line 32
function JSONToValue( |
aData: TJSONData; |
aType: TRttiType |
):TValue; |
aData |
|
The JSON data structure to convert to a TValue |
aType |
|
The RTTI type information for the target value type |
The TValue record representing the converted JSON data
JSONToValue converts a JSON data structure to its corresponding TValue record using the provided RTTI type information. The function supports conversion of JSON strings to Pascal strings (AnsiString, UnicodeString), JSON numbers to integers (Integer, Int64, QWord), JSON booleans to Pascal booleans, and JSON arrays to dynamic arrays. For dynamic arrays, the function recursively converts each JSON array element using the array's element type information. The function uses TValue.Make and TValue.FromArray to construct the appropriate TValue representation.
May raise an exception if the conversion fails or if there is a type mismatch between the JSON data and the expected type.
|
Converts a TValue to a JSON data structure |