Am 13.04.2015 um 22:52 schrieb yawniek:

On Mon, 13 Apr 2015 19:43:02 GMT, Sönke Ludwig wrote:

class Handshake
{
      int some;
      string other;
}

This is done with deserializeJson: json["data"].deserializeJson!Handshake
You can process nested structures, arrays, AAs etc. with it. If performance is a concern, this also allows to process the JSON sting directly, without parsing it into a Json value first, so this is the generally recommended way to work with specific JSON structures.

nice, i somehow missed that.

  • can/will it ignore additional properties within the doc that are not defined in the class?

Yes, it currently always does. There should probably also be a strict
mode, though...

  • whats actually the current status of https://github.com/s-ludwig/stddatajson/tree/master/source/stdx/data/json versus vibe.d's parser?

It's planned to deprecate the one in vibe.d as soon as it lands in
Phobos. It will first be layered on top of stdx.data.json (when it will
hopefully be std.experimental.data.json) with implicit convertibility
using alias this. Then all of vibe.d's own functions will be switched
to use stdx.data.json. Finally, after (hopefully) it got renamed to
std.data.json, vibe.data.json.Json will get deprecated and
eventually be removed.

Apart from that, it will not affect vibe.data.serialization or
serializeToJson.

i used the stddatajson for reading specific fields from a stream of docs where i needed only the header and it was way faster than anything else in d (but still half the speed i got with crystal).
i hope stddatajson makes into std, the lexer/parser are very nice to read!

Did you try the latest version? At least with LDC and using full
optimizations we finally got some numbers that were faster than Crystal
or RapidJSON. DMD is still behind RapidJSON, but I think it was on par
with Crystal. There is still potential for optimization, so I'm pretty
sure that we'll have a very compelling package in the end.