deserialize

Deserializes and returns a serialized value.

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

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

Examples

Note that there is a convenience function dutils.data.json.deserializeJSON that can be used instead of manually invoking deserialize.

import dutils.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");

See Also

dutils.data.json.JSONSerializer, dutils.data.json.JSONStringSerializer, dutils.data.bson.BsonSerializer

Meta