News for hackers. Stuff that matters.
Re:Parsing JSON is a Minefield by microcolonel on Wednesday October 26, 2016 @12:21PM (#12797780)
Some parsers are dealing with known good input, and should not include validation code for performance reasons. Often you will parse the same JSON many times throughout a pipeline, but you only really need to validate it once. A good example of this is a scatter-gather message bus, where the router parses a message record, scatters it to a large number of peers, and gathers responses. Depending on how latency-critical this system is, it can make sense to validate and normalize the representation at the router, and send normalized (whitespace-free) JSON to the compute nodes.
Re:Parsing JSON is a Minefield by bandrami on Wednesday October 26, 2016 @01:22PM (#12798436)
Even if the json source is $DEITY's own platinum-iridium json generator, the json has to actually get to your parser somehow, and you can't guarantee that it did so in one piece. Memory is finite, no bus is perfect, etc.
Re:Parsing JSON is a Minefield by nitrogen on Wednesday October 26, 2016 @06:14PM (#12801171)
Might as well translate validated JSON to a faster binary format for the internal bus, e.g. MessagePack. Validated msgpack is probably faster than unvalidated JSON.