Read and write JSON-stat in Julia.
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
src
test
.codecov.yml
.gitignore
.travis.yml
LICENSE.md
README.md
REQUIRE
appveyor.yml

README.md

JSONStat

Build Status

Coverage Status

codecov.io

This package can be used to read and write datasets in the JSON-stat format. It is intended be used with JuliaIO JSON, DataFrames and DataStructures.

To read a JSON-stat file containing a dataset.

using JSONStat
import JSON
oecdjsonstat = JSON.parsefile("test/data/oecd.json",
	dicttype = DataStructures.OrderedDict)
oecd = readjsondataset(oecdjsonstat)

Parses the contents of test/oecd.json into an OrderedDict, oecd. The DataFrame oecd["datasetframe"] will contain columns with all data dimensions defined in dimension in oecd.json and the values defined in value.

Older bundle responses containing a map of datasets can also be read:

oecdcajsonstat = JSON.parsefile("test/data/oecd-canada.json",
	dicttype = DataStructures.OrderedDict)
oecdca = readjsonbundle(oecdcajsonstat)

Dictionaries with labels for a specific category can be converted to DataFrames, e.g. to be joined with the main datasetframe for a dataset:

areaframe = labelframe("area", oecd)
join(oecd["datasetframe"], areaframe, on = :area)

OrderedDicts with datasets can be written to JSON-stat:

JSON.json(writejsondataset(oecd), 1)