post url در دلفی از طریق http
function PostExample: string;
var
lHTTP: TIdHTTP;
lParamList: TStringList;
begin
lParamList := TStringList.Create;
lParamList.Add('id=1');
lHTTP := TIdHTTP.Create;
try
Result := lHTTP.Post('http://blahblahblah...', lParamList);
finally
lHTTP.Free;
lParamList.Free;
end;
end;
نمایش json به تفکیک
uses system.json
procedure TForm1.Button2Click(Sender: TObject);
var
JSonObject:TJSonObject;
st :='{"code":200,"message":"OK","data":{"code":3271,"mobile":"1"}}';
JSonValue:TJSonValue;
st:string;
Begin
JsonValue:=JSonObject.ParseJSONValue(st);
JSonObject := TJSonObject.Create;
memo1.text:=(JsonValue as TJSONObject).Get('code').JsonValue.Value;
// JsonValue:=(JsonValue as TJSONObject).Get('data').JsonValue;
JSonObject.Free;
end;