var FirstJSObject: TJSONObject;
SecondJSObject: TJSONObject;
ThirdJSObject: TJSONObject;
FourthJSObject: TJSONObject;
FivthJSObject: TJSONObject;
SixthJSObject: TJSONObject;
SeventhJSObject: TJSONObject;
EigthJSObject: TJSONObject;
FirstArr: TJSONArray;
FirstJSValue: TJSONValue;
SecondJSValue: TJSONValue;
ThirdJSValue: TJSONValue;
FourthJSValue: TJSONValue;
FivthJSValue: TJSONValue;
SixthJSValue: TJSONValue;
SeventhJSValue: TJSONValue;
EigthJSValue: TJSONValue;
StreamString: widestring;
j: integer;
begin
StreamString := Get_MData(edt_URL.Text, true);
Get_FirstJSValue('
data', StreamString, FirstJSObject, FirstJSValue);
Try
if Assigned(FirstJSValue)
and (FirstJSValue
is TJSONObject)
then begin
Get_NextJSValue('
device', FirstJSValue, SecondJSObject, SecondJSValue);
if Assigned(SecondJSValue)
and (SecondJSValue
is TJSONObject)
then begin
Get_NextJSValue('
deviceStatus', SecondJSValue, ThirdJSObject, ThirdJSValue);
if Assigned(ThirdJSValue)
and (ThirdJSValue
is TJSONObject)
then begin
Get_NextJSValue('
workstep', ThirdJSValue, FourthJSObject, FourthJSValue);
if Assigned(FourthJSValue)
and (FourthJSValue
is TJSONObject)
then begin
Get_NextJSValue('
job', FourthJSValue, FivthJSObject, FivthJSValue);
if Assigned(FivthJSValue)
and (FivthJSValue
is TJSONObject)
then begin
Get_NextJSValue('
jobCustomer', FivthJSValue, SixthJSObject, SixthJSValue);
if Assigned(SixthJSValue)
and (SixthJSValue
is TJSONObject)
then begin
Get_NextJSValue('
', FivthJSValue, SeventhJSObject, SeventhJSValue);
end;
end;
end;
Get_NextJSValue('
employees', ThirdJSValue, FourthJSObject, FourthJSValue);
if Assigned(FourthJSValue)
and (FourthJSValue
is TJSONArray)
then begin //JSONARRAY
FirstArr := TJSONArray(FourthJSValue);
for j := 0
to FirstArr.Count - 1
do begin
if FirstArr.Items[j]
is TJSONObject
then begin
EigthJSObject := TJSONObject(FirstArr.Items[j]);
end;
end;
end;
end;
end;
end;
//Daten von Objekt abfragen
ExtracJSValues(FirstJSObject, SecondJSObject, ThirdJSObject, FourthJSObject, FivthJSObject, SixthJSObject, SeventhJSObject, EigthJSObject,
nil);
finally
FirstJSObject.Free;
{SecondJSObject.Free; //Hier gibt es eine Zugriffs-Exception
ThirdJSObject.Free;
FourthJSObject.Free;
FivthJSObject.Free;
SixthJSObject.Free;
SeventhJSObject.Free;
EigthJSObject.Free;}
end;
end;