serialize

Serializes a value with the given serializer.

The serializer must have a value result for the first form to work. Otherwise, use the range based form.

  1. auto serialize(T value, ARGS args)
    serialize
    (
    Serializer
    T
    ARGS...
    )
    (,
    ARGS args
    )
  2. void serialize(Serializer serializer, T value)

Examples

import vson.json;

struct Test {
	int value;
	string text;
}

Test test;
test.value = 12;
test.text = "Hello";

Json serialized = serialize!JsonSerializer(test);
assert(serialized.value.get!int == 12);
assert(serialized.text.get!string == "Hello");

See Also

vson.json.JsonSerializer, vson.json.JsonStringSerializer, vson.bson.BsonSerializer

Meta