serializeToPrettyJSON

Serializes the given value to a pretty printed JSON string.

  1. void serializeToPrettyJSON(R destination, T value)
  2. string serializeToPrettyJSON(T value)
    string
    serializeToPrettyJSON
    (
    T
    )
    (
    auto ref 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