vibe.d beta banner
get vibe.d
0.10.0

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

Function deserialize

Deserializes and returns a serialized value.

T deserialize(Serializer, T, ARGS...) (
  ARGS args
);

serialized_data can be either an input range or a value containing the serialized data, depending on the type of serializer used.

See Also

JsonSerializer, JsonStringSerializer, BsonSerializer

Example

Note that there is a convenience function deserializeJson that can be used instead of manually invoking deserialize.

import vibe.data.json;

struct Test {
	int value;
	string text;
}

Json serialized = Json.emptyObject;
serialized["value"] = 12;
serialized["text"] = "Hello";

Test test = deserialize!(JsonSerializer, Test)(serialized);
assert(test.value == 12);
assert(test.text == "Hello");
Authors

Sönke Ludwig

Copyright

© 2013-2016 rejectedsoftware e.K.

License

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