System.JSON.TJSONObject

Delphi
TJSONObject = class sealed(TJSONValue)
C++
class PASCALIMPLEMENTATION TJSONObject : /*[[sealed]]*/ public TJSONValue
Properties
Type | Visibility | Source | Unit | Parent |
---|---|---|---|---|
class | public | System.JSON.pas System.JSON.hpp |
System.JSON | System.JSON |
Description
Implements a JSON object.
TJSONObject is the class that implements a JSON object.
The Parse method can be used to parse a JSON data stream and store the encountered JSON pairs into the TJSONObject instance.
The ParseJSONValue method can be used to parse a byte array and create the corresponding JSON value from this data.
Example
The following is an example of how to parse JSON data using TJSONObject
program JsonTest;
{$APPTYPE CONSOLE}
uses
System.JSON;
var
S: string;
Obj: TJSONObject;
begin
S := '{"sid": "1234567890ABCDEF", "status": "queued"}';
try
Obj := TJSONValue.ParseJSONValue(S, False {UseBool}, True {RaiseException}) as TJSONObject;
try
Writeln(Obj.GetValue<string>('sid'), ' ', Obj.GetValue<string>('status'));
finally
Obj.Free;
end;
except
on E: EJSONException do
Writeln( E.Message );
end;
end.
When you run it, the following is the output:
1234567890ABC