Sollte so gehen:
Delphi-Quellcode:
unit uDMHTTP;
interface
uses
System.SysUtils, System.Classes, System.Net.URLClient, System.Net.HttpClient, System.Net.HttpClientComponent;
type
TDMHTTP =
class(TDataModule)
NetHTTPRequest1: TNetHTTPRequest;
NetHTTPClient1: TNetHTTPClient;
private
{ Private declarations }
public
function GetRespString(
const aURL:
string):
string;
end;
var
DMHTTP: TDMHTTP;
implementation
{$R *.dfm}
{ TDMHTTP }
function TDMHTTP.GetRespString(
const aURL:
string):
string;
var
strstr: TStringStream;
begin
strstr :=
nil;
try
strstr := TStringStream.Create;
NetHTTPRequest1.Get(aURL, strstr);
// strstr.SaveToFile('c:\temp\_a.json')
Result := strstr.DataString;
finally
strstr.Free;
end;
end;
end.
Also:
jsonstr:= DMHTTP.GetRespString('http://192.168.1.91/v1/current_conditions/xxxx.json');
Dann den jsonstr mit TJSONObject bzw. TJSONArray,
unit System.JSON, auswerten.