fromString

Deserializes data from a string.

String is assumed to be UTF-8 encoded.

T
fromString
(
T
Format
DeSiryulize flags = DeSiryulize.none
U
)
(
U str
)
if (
isSiryulizer!Format &&
isInputRange!U
)

Parameters

T

Type of the data to be deserialized

Format

Serialization format ($(SUPPORTEDFORMATS))

str U

A string containing serialized data in the specified format

Supports $(SUPPORTEDSTRUCTURES).

Return Value

Type: T

Data contained in the string

Examples

struct TestStruct {
	string a;
}
//Compare a struct serialized into two different formats
const aStruct = fromString!(TestStruct, JSON)(`{"a": "b"}`);
const anotherStruct = fromString!(TestStruct, YAML)("---\na: b");
assert(aStruct == anotherStruct);

Meta