uses
superobject;
procedure
TForm1
.
FormCreate(Sender: TObject);
var
aJson: ISuperObject;
aSuperArray: TSuperArray;
i:
Integer
;
begin
aJson:=SO(
'{"zoo":"涂磊动物园","animals":[{"name":"猴子","year":"12"},{"name":"老虎","year":"132"}]}'
);
if
aJson[
'animals'
]<>
nil
then
showmessage( aJson[
'animals'
].AsString );
aSuperArray:= aJson[
'animals'
].AsArray;
for
i:=
0
to
aSuperArray
.
Length-
1
do
memo1
.
Lines
.
Add(aSuperArray[i][
'name'
].AsString+aSuperArray[i][
'year'
].AsString);
aJson:=SO(
'{"code":0,"data":{"area":"华东","area_id":"300000","city":"宜春市","city_id":"360900","country":"中国","country_id":"CN","county":"","county_id":"","ip":"59.62.201.110","isp":"电信","isp_id":"100017","region":"江西省","region_id":"360000"}}'
);
if
aJson[
'data.country'
]<>
nil
then
showmessage( aJson[
'data.country'
].AsString );
end
;