On Wed, 18 Apr 2012 10:05:57 -0500, Andrej Mitrovic 
<[email protected]> wrote:

On 4/18/12, Robert Jacques <[email protected]> wrote:
here are some results for your benchmark on
my own serializers:

JSON serialize: 0.331831 s
JSON deserialize: 0.243893 s

Hey Robert, I was trying out your JSON library a while ago ago (I
didn't find a repository but just a newsgroup link to the sources),
and the library seemed to be missing the JSON.to! template, even
though it was documented. Maybe you have a link to the newer sources?
Thanks.


Thank you. Sorry, the example code got stale. When I switched to using a 
Variant for JSON, the to! moved into Variant. So the documentation example 
should read:

Json     json = JSON.parse( "[1,2,3]" );    // Parse an input range
MyStruct var  = json.to!MyStruct();         // De-serialize a type
         json = JSON.from(var);             // Serialize a type

enforce(JSON.isValid(json));                // Validate the serialization
write("var.json", JSON.toStringHR(json));   // Write in a "pretty" format

json = JSON.parse( "{x:1,y:2,z:3}" );
assert( json.x + json.y == 3 );             // Perform operations on a Json

Reply via email to