function JSONParse(const aJSONData: string; const aMemo: TMemo): boolean;
var
aJSValue: TJSONValue;
aJSObject: TJSONObject;
aJSArray: TJSONArray;
I, J: integer;
begin
Result := false;
aJSValue := TJSONObject.ParseJSONValue(aJSONData) as TJSONValue;
if Assigned(aJSValue) then
begin
aJSObject := aJSValue as TJSONObject;
if Assigned(aJSObject) then
begin
for I := 0 to aJSObject.Count - 1 do
begin
aMemo.Lines.Add(aJSObject.Pairs[I].JsonString.Value + '=' + aJSObject.Pairs[I].JsonValue.Value);
if aJSObject.GetValue(aJSObject.Pairs[I].JsonString.Value) is TJSONArray then
begin
aJSArray := aJSObject.GetValue(aJSObject.Pairs[I].JsonString.Value) as TJSONArray;
if Assigned(aJSArray) then
begin
for J := 0 to aJSArray.Count - 1 do
aMemo.Lines.Add(aJSArray.Items[J].Value);
end;
end;
end;
end;
end;
Result := true;
end;
JSONParse('{"desc":"Описания...","otdel":["1","12","300"],"manufacturer":"ООО \"Привет\""}', Memo1)