Alternative:
Delphi-Quellcode:
program Project1;
{$R *.res}
uses System.SysUtils, System.JSON;
const
input = '{"status":"success","data":{"status":"online","benchmarking":"TEST","online":"connected"}}';
var
jsonObj: TJsonObject;
status: String;
begin
jsonObj := TJSONObject.ParseJSONValue(input) as TJsonObject;
if(not Assigned(jsonObj)) then
WriteLn('input is no valid json object')
else
try
status := jsonObj.GetValue<String>('data.status');
WriteLn('status is ', status);
finally
jsonObj.Destroy();
end;
end.
ahhh, das "data.status" hatte ich nicht so....
Danke an beide! So langsam begreife ich es mal...