serializeToPrettyJson

Serializes the given value to a pretty printed JSON string.

  1. void serializeToPrettyJson(R destination, T value)
    void
    serializeToPrettyJson
    (
    R
    T
    )
    (,
    auto ref T value
    )
    if (
    isOutputRange!(R, char) ||
    isOutputRange!(R, ubyte)
    )
  2. string serializeToPrettyJson(T value)

Examples

	struct Foo {
		int number;
		string str;
	}

	Foo f;
	f.number = 12;
	f.str = "hello";

	string json = serializeToPrettyJson(f);
	assert(json ==
`{
	"number": 12,
	"str": "hello"
}`);

See Also

serializeToJson, vibe.data.serialization

Meta