WriteToString([Options: JsonFormatOptions =0]);
Options. View format when writing.
The WriteToString method returns string view of JSON structure.
Function CreateJson: String;
Var
NewJSON: IJsonObjectBuilder;
Doc: IJsonDocument;
Begin
NewJSON := New JsonObjectBuilder.Create;
NewJSON.AddBoolean("Bool", True);
NewJSON.AddDouble("Double", 3.14);
NewJSON.AddInteger("Integer", 100);
NewJSON.AddNull("Null");
NewJSON.AddString("String", "Test JSON");
NewJSON.AddBoolean("Bool", True);
// Get string view
Doc := New JsonDocument.Create;
Doc.RootElement := NewJSON.Build;
Return Doc.WriteToString;
End Function CreateJson;
The specified function creates a new JSON structure with a set of elements. The function results in a string view of the obtained JSON structure.
See also: