JSON select to CSV
Map deep json structures selectively to a flat object. Root object needs to be an object not an array. Can be called in command line to and supports parsing flat file to csv
Install
npm install -g json-flat-select
Map.json
{
"name": "name",
"age": "info.more.age"
"result1": "results[0].value"
"resultFallback": ["results[0].value","results[0].error"]
}
Command Line Usage
json-flat-select ./**/*.json pathToRowMapFile > data.json
json-flat-select ./**/*.json pathToRowMapFile ',' > data.csv
json-flat-select ./**/*.json pathToRowMapFile '\t' > data.tsv
Module Usage
var jsonFlatSelect = require('json-flat-select')
var rowMap = require('PUT_PATH_TO_ROW_MAP_HERE.json')
var csvTable = jsonFlatSelect('*.json', rowMap)
Test
npm test