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)
  2. T deserializeJSON(JSON src)
  3. T deserializeJSON(R input)
    T
    deserializeJSON
    (
    T
    R
    )
    ()
    if (
    !is(R == JSON) &&
    isInputRange!R
    )

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