How to get the subitem value from an API Response in Delphi? [closed]

I need to get the subitem information of a LResponse

I want to get the "subitem1" value

 "Information":{
      "subitem1":"2011",
      "subitem2":"Test"
   }

I am using this code to get the other values, but I don't know how to acess the subitems, 'subitem1' is returning null

var
  LClient: TRESTClient;
  LRequest: TRESTRequest;
  LResponse: TRESTResponse;
begin

  LClient := TRESTClient.Create(URL_API);
  try
    LRequest := TRESTRequest.Create(LClient);
    try
      LResponse := TRESTResponse.Create(LClient);
      try
        LRequest.Client := LClient;
        LRequest.Response := LResponse;
        LRequest.Method := rmGET;
        LRequest.Params.AddHeader('Authorization','Bearer '+FToken);
        LRequest.Params.ParameterByName('Authorization').Options := [poDoNotEncode];
        LRequest.Params.AddHeader('Accept', 'application/json');
        LRequest.Execute;

        LResponse.GetSimpleValue('subitem1', FLogradouro);


Read more here: https://stackoverflow.com/questions/64885897/how-to-get-the-subitem-value-from-an-api-response-in-delphi

Content Attribution

This content was originally published by BDuarte at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: