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