- 人气:
- 放大
- 缩小
- 二维码
- 赞赏
delphi TMS WEB core WebHttpRequest1 解析JSON
{"Result":"OK","Records":[{"id":504},{"id":505},{"id":534},{"id":535},{"id":536}]}
procedure TForm1.WebHttpRequest1Response(Sender: TObject; AResponse: string);
var
js: TJSON;
ja: TJSONArray;
jo: TJSONObject;
i: integer;
begin
jo := js.Parse(AResponse);
ja := TJSONArray(jo.GetValue('Records'));
ShowMessage('Retrieved items:' +inttostr(ja.Count));
for i := 0 to ja.Count - 1 do
begin
jo := ja.Items[i];
WebListBox1.Items.Add(jo.GetJSONValue('id'));
end;
finally
js.Free;
end;
end;