vibe.d beta banner
get vibe.d
0.10.0

Asynchronous I/O that doesn’t get in your way, written in D

Function deserializeJson

Deserializes a JSON value into the destination variable.

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

T deserializeJson(T) (
  Json src
);

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

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

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 Sönke Ludwig

License

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