### Reading JSON-stat Dataset in Julia Source: https://github.com/klpn/jsonstat.jl/blob/master/README.md This snippet demonstrates how to read a single JSON-stat dataset from a file using JSONStat.jl. It first parses the JSON file into an OrderedDict using JSON.jl and DataStructures.jl, then processes the resulting dictionary into a dataset object using readjsondataset. ```Julia using JSONStat import JSON oecdjsonstat = JSON.parsefile("test/data/oecd.json", dicttype = DataStructures.OrderedDict) oecd = readjsondataset(oecdjsonstat) ``` -------------------------------- ### Reading JSON-stat Bundle in Julia Source: https://github.com/klpn/jsonstat.jl/blob/master/README.md This code shows how to read an older JSON-stat 'bundle' response containing multiple datasets. It parses the JSON file into an OrderedDict and then uses readjsonbundle to process the bundle structure. ```Julia oecdcajsonstat = JSON.parsefile("test/data/oecd-canada.json", dicttype = DataStructures.OrderedDict) oecdca = readjsonbundle(oecdcajsonstat) ``` -------------------------------- ### Writing JSON-stat Dataset in Julia Source: https://github.com/klpn/jsonstat.jl/blob/master/README.md This code snippet shows how to convert a processed dataset object (oecd) back into an OrderedDict suitable for JSON-stat output using writejsondataset. The resulting dictionary is then serialized into a formatted JSON string using JSON.json with an indentation level of 1. ```Julia JSON.json(writejsondataset(oecd), 1) ``` -------------------------------- ### Converting JSON-stat Labels to DataFrame and Joining in Julia Source: https://github.com/klpn/jsonstat.jl/blob/master/README.md This snippet demonstrates how to extract category labels for a specific dimension ("area") from a JSON-stat dataset using labelframe, converting them into a DataFrame. It then shows how to join this label DataFrame with the main dataset DataFrame (oecd["datasetframe"]) using the dimension column as the join key. ```Julia areaframe = labelframe("area", oecd) join(oecd["datasetframe"], areaframe, on = :area) ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.