Serialize an instance of a user-defined type to a json object.
import jsonizer.jsonize; import jsonizer.fromjson; static struct Foo { mixin JsonizeMe; @jsonize { int i; string[] a; } } auto foo = Foo(12, [ "a", "b" ]); auto json = foo.toJSON(); assert(json.fromJSON!int("i") == 12); assert(json.fromJSON!(string[])("a") == [ "a", "b" ]);
Convert a user-defined type to json. See jsonizer.jsonize for info on how to mark your own types for serialization.