Function serializeToPrettyJson
Serializes the given value to a pretty printed JSON string.
void serializeToPrettyJson(R, T)
(
R destination,
auto ref T value
)
if (isOutputRange!(R, char) || isOutputRange!(R, ubyte));
string serializeToPrettyJson(T)
(
auto ref T value
);
See also
Example
struct Foo {
int number;
string str;
}
Foo f;
f .number = 12;
f .str = "hello";
string json = serializeToPrettyJson(f);
assert(json ==
`{
"number": 12,
"str": "hello"
}`);