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) &&
    isForwardRange!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