-
Notifications
You must be signed in to change notification settings - Fork 4
JSON data format
In addition to reading CSV, Google Sheets and Microsoft Excel formats, the HXL Proxy can read and write data in two JSON flavours. More details on HXL JSON representations are available in the HXL 1.1 standard.
List of lists: The first flavour mimics a spreadsheet by providing a list of rows, each of which is a list of values. One of the rows should contain HXL hashtags, as in a spreadsheet:
[
["Province", "District", "Number of people affected"],
["#adm1 +name", "#adm2 +name", "#affected"],
["Capital", "Cornice Ward", 200],
["Capital", "Business Ward", 150],
["Plains", "Forest Distict", 800]
]
List of objects: The second format is a more-conventional format for JSON APIs, providing a list of JSON objects (aka dictionaries, hashtables, associative-arrays):
[
{
"#adm1+name": "Capital",
"#adm2+name": "Cornice Ward",
"#affected": 200
},
{
"#adm1+name": "Capital",
"#adm2+name": "Business Ward",
"#affected": 150
},
{
"#adm1+name": "Plains",
"#adm2+name": "Forest District",
"#affected": 800
}
]
This second flavour will be easier for many web developers, but it also has some shortcomings:
- It is not possible to include human-readable text headers in addition to the hashtags.
- It is not possible to include repeated columns (with the same hashtags and attributes).
- The representation is less compact because of the repeated keys.
To export any HXL dataset as JSON (regardless of its original format), see the View page.
Learn more about the HXL standard at http://hxlstandard.org