JSON data sources

David Megginson edited this page Oct 29, 2016 · 5 revisions

(For coders)

A JSON data source is a JSON encoding for including a separate HXL source URL and transformation recipe inside a higher-level JSON recipe. You can use a JSON data source wherever you would include the URL of a HXL dataset.

Properties

The JSON representation is an object (dictionary) with the following properties:

Property Required Description Example
input yes A [[URL Special URL handling]] or another embedded source.
sheet_index no The zero-based index of the tab to use in an Excel workbook. 1
tagger no A [[JSON tagger JSON taggers]] for adding hashtags to a non-HXL source.
recipe no A [[JSON recipe JSON recipes]] for transforming the source.

Example

The following JSON recipe includes one Append datasets filter that references the appended dataset directly by URL:

[
    {
        "filter": "append",
        "append_source": "http://example.org/data.csv"
    }
] 

If we needed to transform (or even tag) that dataset before appending it, we could replace the URL with a JSON data spec (in this case, we want to append only the rows that refer to the WASH sector):

[
    {
        "filter": "append",
        "append_source": {
            "input": "http://example.org/data.csv",
            "recipe": [
                {
                    "filter": "with_rows",
                    "queries": "sector=wash"
                }
            ]
        }
    }
] 
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.