Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // PrettyPrintJSON function is from this question
- // http://stackoverflow.com/questions/11797583/jsonvalue-to-indented-string
- var
- I: Integer;
- StringList: TStringList;
- JSONObject: TJSONObject;
- begin
- JSONObject := TJSONObject.Create;
- try
- JSONObject.AddPair(TJSONPair.Create(TJSONString.Create('Hello'), TJSONString.Create('World')));
- JSONObject.AddPair(TJSONPair.Create(TJSONString.Create('Ciao'), TJSONString.Create('Mondo')));
- StringList := TStringList.Create;
- try
- PrettyPrintJSON(JSONObject, StringList);
- for I := 0 to StringList.Count - 1 do
- Writeln(StringList[I]);
- finally
- StringList.Free;
- end;
- finally
- JSONObject.Free;
- end;
- end;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement