deserializeJSON

Deserializes a JSON value into the destination variable.

The same types as for serializeToJSON() are supported and handled inversely.

  1. void deserializeJSON(T dst, JSON src)
    void
    deserializeJSON
    (
    T
    )
    (
    ref T dst
    ,)
  2. T deserializeJSON(JSON src)
  3. T deserializeJSON(R input)

Examples

struct Foo {
  int number;
  string str;
}

Foo f = deserializeJSON!Foo(`{"number": 12, "str": "hello"}`);
assert(f.number == 12);
assert(f.str == "hello");

See Also

serializeToJSON, serializeToJSONString, vibe.data.serialization

Meta