vibe.d beta banner
get vibe.d
0.7.30

Function deserializeJson

Deserializes a JSON value into the destination variable.

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

Prototypes

void deserializeJson(T)(
  ref T dst,
  Json src
);

T deserializeJson(T)(
  Json src
);

T deserializeJson(T, R)(
  R input
)
if (!is(R == Json) && isInputRange!R);

See Also

serializeToJson, serializeToJsonString, vibe.data.serialization

Example

struct Foo {
	int number;
	string str;
}
Foo f = deserializeJson!Foo(`{"number": 12, "str": "hello"}`);
assert(f.number == 12);
assert(f.str == "hello");
Authors

Sönke Ludwig

Copyright

© 2012-2015 RejectedSoftware e.K.

License

Subject to the terms of the MIT license, as written in the included LICENSE.txt file.