2 ms·
I just happen to be working on JSON parsing today. What a mess. People don't even follow what is already there. I've seen several 'JSON' data files like this:
by hermitcrab 6y ago
I just happen to be working on JSON parsing today. What a mess. People don't even follow what is already there. I've seen several 'JSON' data files like this:
{<object>}
{<object>}
That isn't valid JSON, is it? The Qt JSON parser doesn't handle it.
- dak1 6y agoThat looks a bit like NDJSON, assuming that the space between the objects is actually a newline. There are libraries[1] that support parsing it and it's not too hard to do yourself, either. Some fairly popular projects use it to represent multiple responses in a single response body[2]. [1] http://ndjson.org/libraries.html http://ndjson.org/libraries.html [2] ElasticSearch uses it for msearch response bodys, for example.
- hermitcrab 6y agoIt looks like it might be this: https://jsonlines.org/ https://jsonlines.org/ Which I hadn't heard of before.
- ydant 6y agoOr JSON lines - whose website looks very similar to NDJSON's: https://jsonlines.org/ https://jsonlines.org/ This format works great when using Amazon Athena (Presto) against log files written with one JSON object per line.
- quietbritishjim 6y agoBoth the websites are fancy ways of saying "one JSON object per line". The idea of laying out data that way was in common use before either of the website, they're just recording the practice.