RE: JSON data in the wild

I think you'll see both this format and comma-delimited objects in the wild.

{"_id":707860,"name":"Hurzuf","country":"UA","coord":{"lon":34.283333,"lat":44.549999}},
{"_id":519188,"name":"Novinki","country":"RU","coord":{"lon":37.666668,"lat":55.683334}},
{"_id":1283378,"name":"Gorkhâ","country":"NP","coord":{"lon":84.633331,"lat":28}}

I don't think the JSON specification licenses either.  But you frequently want "a collection of objects", a concept that JSON does not define.  You can always put it in an array, but that's an extra node that you don't really want or need.

[
{"_id":707860,"name":"Hurzuf","country":"UA","coord":{"lon":34.283333,"lat":44.549999}},
{"_id":519188,"name":"Novinki","country":"RU","coord":{"lon":37.666668,"lat":55.683334}},
{"_id":1283378,"name":"Gorkhâ","country":"NP","coord":{"lon":84.633331,"lat":28}}
]

You'll also see JSON files in which the keys are not quote delimited. They aren't valid JSON files, but you do see them.

My take:

1. It's OK to require people to make their files valid JSON (e.g. I don't think we need to support keys without quotes)
2. We really should have a serialization format for collections of objects. One format is sufficient, people can massage things into that format.

Jonathan

Jonathan

________________________________
From: Michael Kay [mike@saxonica.com]
Sent: Wednesday, September 09, 2015 5:21 PM
To: public-xsl-query@w3.org
Subject: JSON data in the wild

I tried to download some real JSON data today - from openweathermap.org<http://openweathermap.org> - and found that it’s in a format we can’t handle. Specifically, a sequence of maps/objects, newline-separated:

{"_id":707860,"name":"Hurzuf","country":"UA","coord":{"lon":34.283333,"lat":44.549999}}
{"_id":519188,"name":"Novinki","country":"RU","coord":{"lon":37.666668,"lat":55.683334}}
{"_id":1283378,"name":"Gorkhâ","country":"NP","coord":{"lon":84.633331,"lat":28}}

I wonder if this is common and whether we should cater for it?

Michael Kay
Saxonica

Received on Wednesday, 9 September 2015 21:43:07 UTC