Thema: Delphi DBXJSON in XE4

Einzelnen Beitrag anzeigen

Benutzerbild von Union
Union

Registriert seit: 18. Mär 2004
Ort: Luxembourg
3.487 Beiträge
 
Delphi 7 Enterprise
 
#6

AW: DBXJSON in XE4

  Alt 15. Apr 2015, 13:17
z.B. So:
Delphi-Quellcode:
program DPJSon;

{$APPTYPE CONSOLE}

{$R *.res}

uses
  System.SysUtils,
  Data.DBXJSON;

procedure DumpJSON;
var
  LJSONObject : TJSONObject;
  LJSONPair : TJSONPair;
begin
  LJSONObject := TJSONObject.ParseJSONValue(
    TEncoding.ASCII.GetBytes('{"Uptime":"0T 0H 0M 25S","Wiegungen":"0","Letzte Meldung":"30.12.1899 00:00:00","Waage":"Verbunden"}'), 0) as TJSONObject;

  // Alle auflisten
  for LJSONPair in LJSONObject do
  begin
    Write(LJSONPair.JsonString.Value + '=');
    Writeln(LJSONPair.JsonValue.Value);
  end;

  // Einen bestimmten auflisten
  write('Wert von "Letzte Meldung" ');
  Writeln(LJSONObject.Get('Letzte Meldung').JsonValue.Value);
  Readln;
end;

begin
  DumpJSON;
end.
Ibi fas ubi proxima merces
sudo /Developer/Library/uninstall-devtools --mode=all
  Mit Zitat antworten Zitat