mirror of https://github.com/Hax-io/jstruct
parent
13fe2e1332
commit
eb35dd4b13
|
@ -194,6 +194,10 @@ public RecordType fromJSON(RecordType)(JSONValue jsonIn)
|
||||||
return record;
|
return record;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Example deserialization of JSON
|
||||||
|
* to our `Person` struct
|
||||||
|
*/
|
||||||
unittest
|
unittest
|
||||||
{
|
{
|
||||||
import std.string : cmp;
|
import std.string : cmp;
|
||||||
|
@ -242,6 +246,10 @@ unittest
|
||||||
assert(person.list4 == [1.5, 1.4]);
|
assert(person.list4 == [1.5, 1.4]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Another example deserialization of JSON
|
||||||
|
* to our `Person` struct
|
||||||
|
*/
|
||||||
unittest
|
unittest
|
||||||
{
|
{
|
||||||
import std.string : cmp;
|
import std.string : cmp;
|
||||||
|
|
|
@ -90,6 +90,11 @@ private enum EnumType
|
||||||
DOG,
|
DOG,
|
||||||
CAT
|
CAT
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Example serialization of our struct
|
||||||
|
* `Person` to JSON
|
||||||
|
*/
|
||||||
unittest
|
unittest
|
||||||
{
|
{
|
||||||
import std.algorithm.searching : canFind;
|
import std.algorithm.searching : canFind;
|
||||||
|
|
Loading…
Reference in New Issue