I was trying to use the TWebHttpRequest component to perform a HTTP(s) request to a server.
I'd like to parse the JSON response and I used the example shown at pages 206-207 of the TMS WEB Core v1.2 Padua DEVELOPERS GUIDE as follows:
procedure TForm1.WebHttpRequest1Response(Sender: TObject; AResponse:
string);
var
JO := JA.Items;
JS: TJSON;
JA: TJSONArray;
JO: TJSONObject;
i: integer;
begin
JS := TJSON.Create;
JA := TJSONArray(JS.Parse(AResponse));
for i := 0 to JA.Count - 1 do
begin
JO := JA.Items;
WebListBox1.Items.Add(JO.Get('prop'));
end;
end;
I put the unit WEBLib.JSON in the uses section, but the compiler displays the following error:
[Fatal Error] Incompatible types: got "TJSONValue" expected "TJSONObject"
for the line inside the loop:
JO := JA.Items;
Could you help me?