-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathUnit1.pas
49 lines (39 loc) · 1.13 KB
/
Unit1.pas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, superobject, StdCtrls;
type
TForm1 = class(TForm)
btn1: TButton;
procedure btn1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.btn1Click(Sender: TObject);
var
s1:string;
json_root, itemx:ISuperObject;
idx: Integer;
begin
s1:='{"name":"Henri Gourvest",/*thisisacomment*/"vip":true,"telephones":["000000000","111111111111"],"age":33,"size":1.83,"adresses":[{"adress":"blabla","city":"Metz","pc":57000},{"adress":"blabla","city":"Nantes","pc":44000}]}';
json_root:=SO(s1);
ShowMessage(json_root.S['name'] + ' ' + json_root.S['adresses']);
// for itemx in json_root.S['addresses'] do
// begin
// ShowMessage(itemx.S['address']);
// end;
//ShowMessage(IntToStr(json_root.A['adresses'].Length));
for idx := 0 to json_root.A['adresses'].Length-1 do
begin
itemx:=json_root.A['adresses'].O[idx];
ShowMessage(itemx.S['city']);
end;
end;
end.