How to parse a JSON string in Delphi?

You don’t need to use external libraries to perform a JSONPath search.
Example with Delphi 10 Seattle:

uses  System.JSON;
procedure ParseJSonValue;
var
   JSonValue:TJSonValue;
   st:string;
   Branch: string;
begin
   st := '{"data":{"results":[{"Branch":"ACCT590003"}]}}';
   JsonValue := TJSonObject.ParseJSONValue(st);
   Branch := JsonValue.GetValue<string>('data.results[0].Branch');
   JsonValue.Free;
end;

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)