Utility library for converting JSON to CSV, and vice versa.
This module can convert JSON files to CSV, and vice versa. When converting from JSON to CSV, nestings are written as json-encoded strings in the output CSV. In order to get back to the original JSON file from a CSV, therefore, you should pass parse_nested_json=true
to the convert
function. See Usage.
Since this is an unregistered package, you can install it from the julia prompt as follows:
- over SSH (recommended):
if get(Pkg.installed(), "JsonCsvConverter", false) == false
Pkg.clone("[email protected]:peterbrescia/JsonCsvConverter.jl")
end
- over HTTPS:
if get(Pkg.installed(), "JsonCsvConverter", false) == false
Pkg.clone("https://github.com/peterbrescia/JsonCsvConverter.jl")
end
Dependencies can be found in the REQUIRE
file. Package dependencies should install automatically upon installing this module. Requires Julia v0.5.
using JsonCsvConverter
c = JsonCsvConverter.Converter()
c.convert("in.csv", "out.json")
using JsonCsvConverter
c = JsonCsvConverter.Converter()
c.convert("in.json", "out.csv")
- When parsing a CSV that contains JSON-encoded fields, you can pass
parse_nested_json=true
to decode these fields:
convert("in.csv", "out.json", parse_nested_json=true)