Запрос wget и разбор json


uses fphttpclient, fpjson, jsonparser;

var HttpClient: TFPHttpClient;

begin
  HttpClient:=TFPHttpClient.Create(nil);

  with HttpClient do
  try
    s:=Get(u);
    P:=TJSONParser.Create(s);
    D:=P.Parse;
    if Assigned(D) then
      case D.JSONType of
      jtArray:
        if (D.Count>0) then
        begin
          for i:=0 to D.Count-1 do
          begin
            if (D.Items[i].JSONType=jtObject) then
            begin
             R:=TJSONObject(D.Items[i]);
             FirmID:=R.Extract('id').AsString
             FirmName:=R.Extract('name').AsString;
            end;
          end;
        end;
      end;
  finally
    P.Free;
  end;

  HttpClient.Free;
end;