How can I parse the JSON string
{\"data\":{\"results\":[{\"Branch\":\"ACCT590003\"}]}}
using the T
Try this code, it works fine
uses System.JSON;
procedure _Parse_JSonValue;
var
JSonObject:TJSonObject;
JSonValue:TJSonValue;
st:string;
Branch: string;
Begin
st := '{"data":{"results":[{"Branch":"ACCT590003"}]}}';
JSonObject := TJSonObject.Create;
JsonValue:=JSonObject.ParseJSONValue(st);
JsonValue:=(JsonValue as TJSONObject).Get('data').JSONValue;
JsonValue:=(JsonValue as TJSONObject).Get('results').JSONValue;
if (JSONValue is TJSONArray) then
Branch := ((JSONValue as TJSONArray).Items[0] as TJSonObject).Get('Branch').JSONValue.Value;
JSonObject.Free;
End;
Branch = 'ACCT590003'