Converts a TValue to a JSON data structure
Source position: fpjsonvalue.pp line 31
function ValueToJSON( |
const aValue: TValue; |
aType: TRttiType |
):TJSONData; |
aValue |
|
The TValue record to convert to JSON |
aType |
|
The RTTI type information for the value being converted |
The JSON data structure representing the converted value
ValueToJSON converts a TValue record to its corresponding JSON representation using the provided RTTI type information. The function supports conversion of strings (AnsiString, UnicodeString, WideString, ShortString), integers (Integer, Int64, QWord), booleans, and dynamic arrays. For dynamic arrays, the function recursively converts each element using the array's element type information. If an error occurs during conversion, any partially created JSON structure is cleaned up before re-raising the exception.
May raise an exception if the conversion fails or if an unsupported type is encountered.
|
Converts JSON data to a TValue record |