All Projects → jsnell → json-to-multicsv

jsnell / json-to-multicsv

Licence: MIT license
Split a JSON file with hierarchical data to multiple CSV files

Programming Languages

perl
6916 projects

Projects that are alternatives of or similar to json-to-multicsv

csv2xlsx
Fast and simple opensource command line tool to convert CSV do XLSX
Stars: ✭ 38 (+65.22%)
Mutual labels:  csv
FileConvert
Converts between file formats such as CSV and Parquet
Stars: ✭ 14 (-39.13%)
Mutual labels:  csv
badsv
The official BaDSV specification and CLI. Ascend from your puny DSV files!
Stars: ✭ 50 (+117.39%)
Mutual labels:  csv
tabular-stream
Detects tabular data (spreadsheets, dsv or json, 20+ different formats) and emits normalized objects.
Stars: ✭ 34 (+47.83%)
Mutual labels:  csv
municipios-br
Dados em formato aberto sobre municípios e unidades federativas do Brasil.
Stars: ✭ 58 (+152.17%)
Mutual labels:  csv
OBIS
A JavaScript framework for downloading bank statements in OFX, QIF, CSV, and JSON. Currently supports HSBC UK Personal Banking.
Stars: ✭ 37 (+60.87%)
Mutual labels:  csv
Textrude
Code generation from YAML/JSON/CSV models via SCRIBAN templates
Stars: ✭ 79 (+243.48%)
Mutual labels:  csv
ngx-csv
Angular directive to generate a CSV download in the browser
Stars: ✭ 34 (+47.83%)
Mutual labels:  csv
DataProfiler
What's in your data? Extract schema, statistics and entities from datasets
Stars: ✭ 843 (+3565.22%)
Mutual labels:  csv
node-emails-from-csv
A simple NodeJS aplication that helps sending emails for events. Uses CSV files for target users.
Stars: ✭ 18 (-21.74%)
Mutual labels:  csv
csvtogs
Take a CSV file and create a Google Spreadsheet with the contents
Stars: ✭ 15 (-34.78%)
Mutual labels:  csv
import-cli-simple
This the meta package for Pacemaker Community, a Symfony based CLI application that provides import functionality for products, categories, attributes, and attribute-sets. The default format is CSV, adapters for XML are also available. The application can be declaratively extended by additional operations, which can be used to reassemble and exe…
Stars: ✭ 69 (+200%)
Mutual labels:  csv
DaFlow
Apache-Spark based Data Flow(ETL) Framework which supports multiple read, write destinations of different types and also support multiple categories of transformation rules.
Stars: ✭ 24 (+4.35%)
Mutual labels:  csv
phpunit-extensions
📦 Some cool extensions for PHPUnit
Stars: ✭ 28 (+21.74%)
Mutual labels:  csv
Workout
A simple iOS app that accesses Health data to export workout data to CSV for any use.
Stars: ✭ 39 (+69.57%)
Mutual labels:  csv
ottosocial
👍 ottosocial is a CLI to schedule tweets via CSV
Stars: ✭ 23 (+0%)
Mutual labels:  csv
flowtorch
flowTorch - a Python library for analysis and reduced-order modeling of fluid flows
Stars: ✭ 47 (+104.35%)
Mutual labels:  csv
openbrewerydb
🍻 An open-source dataset of breweries, cideries, brewpubs, and bottleshops.
Stars: ✭ 115 (+400%)
Mutual labels:  csv
libcsv
libcsv is a small, simple and fast CSV library written in pure ANSI C89 that can read and write CSV data. | libcsv是用纯ANSI C89编写的小型、简单、快速的CSV库,支持读写CSV数据.
Stars: ✭ 23 (+0%)
Mutual labels:  csv
cubetl
CubETL - Framework and tool for data ETL (Extract, Transform and Load) in Python (PERSONAL PROJECT / SELDOM MAINTAINED)
Stars: ✭ 21 (-8.7%)
Mutual labels:  csv

NAME

json-to-multicsv.pl - Split a JSON file with hierarchical data to multiple CSV files

SYNOPSIS

json-to-multicsv.pl [ --path pathspec:handler ... ] [ --file input-file ] [ --table name ]

DESCRIPTION

Read in a JSON file, process it according as specified by the --path arguments, and output one or multiple CSV files with the same data in tabular format.

EXAMPLE

Assuming the following input file:

{
    "item 1": {
        "title": "The First Item",
        "genres": ["sci-fi", "adventure"],
        "rating": {
            "mean": 9.5,
            "votes": 190
        }
    },
    "item 2": {
        "title": "The Second Item",
        "genres": ["history", "economics"],
        "rating": {
            "mean": 7.4,
            "votes": 865
        },
        "sales": [
            { "count": 76, "country": "us" },
            { "count": 13, "country": "de" },
            { "count": 4, "country": "fi" }
        ]
    }
}

And the following command line flags:

--path /:table:item
--path /*/rating:column
--path /*/sales:table:sales
--path /*/genres:table:genres

You'd get the following output files, which can be joined together using the *._key fields.

item.csv:

item._key,item.rating.mean,item.rating.votes,item.title
"item 1",9.5,190,"The First Item"
"item 2",7.4,865,"The Second Item"

item.genres.csv:

genres,item._key,item.genres._key
sci-fi,"item 1",1
adventure,"item 1",2
history,"item 2",1
economics,"item 2",2

item.sales.csv:

item._key,item.sales._key,sales.count,sales.country
"item 2",1,76,us
"item 2",2,13,de
"item 2",3,4,fi

OPTIONS

--file input-file

Read the JSON input from input-file.

--path pathspec:table:name

Values matching pathspec should be used to open a new table, with the specified name. The value should be either an object or an array. For an object, each field of the object will be used to output a row in the CSV file corresponding to the new table. The name of the field stored in the tablename._key column. For an array, each element of the array will be used to output a row, with the index of the element (starting from 1) stored in the tablename._key column.

If multiple tables are nested, the key columns of all outer tables will be also emitted in the inner tables.

--path pathspec:column

Values matching pathspec should be used to emit one or more columns in the CSV file matching the innermost currently open table, on the currently open row. (If no table is currently open).

If the value is a scalar, that value will be output to a column named after the field containing the value as the column name. Note: Scalar values have an implicit column handler.

If the value is an object, each of the fields of the object will be used to to output a column with the name being based on both the name of that field, and the name of the field that contained the object.

--path pathspec:row

The values matching pathspec will be emitted as new rows. The value must be an object. The name of the field containing the value will be ignored. This is generally only useful for the toplevel JSON value.

--path pathspec:ignore

Values matching pathspec (and any of their subvalues) will not be processed at all.

--table name

Specifies the name of the toplevel table, assuming the toplevel JSON value is not used to define a table but row data. You will probably want to use a row handler for the toplevel element.

PATHS AND PATHSPECS

The path to a specific JSON value is determined by the following rules:

- The path of the root element is / - The path of a value that's directly contained inside an object is the concatenation of: a) the path of the parent object, b) the '/', c) the field in the object that this value is for. - The path of a value that's directly contained inside an array is the concatenation of: a) the path of the parent object, b) the '/', c) the 1-based index in the array of the value.

Paths are matched against with pathspecs. In a pathspec any of the elements of the path can instead be replaced with a *, which will match any element in that position (but not multiple adjacent ones). That is, the pathspec /a/*/c will match a/b/c but not a/b/b/c.

AUTHOR

Juho Snellman, <[email protected]>

LICENSE

Standard MIT license

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].