# json-flat-select

> Map deep json structures selectively to csv.

Latest version **1.2.1** (published 2018-03-21) · MIT license · 0 weekly downloads

## Install

```sh
npm install json-flat-select
pnpm add json-flat-select
yarn add json-flat-select
bun add json-flat-select
```

Provides the command `json-flat-select`.

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.2.1 |
| Published | 2018-03-21 |
| First published | 2018-03-12 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Unpacked size | 7.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | ian@linehq.com |
| Maintainers | ianjorgensen |

## Links

- npm: https://www.npmjs.com/package/json-flat-select
- Repository: https://github.com/ianjorgensen/json-flat-select
- Homepage: https://github.com/ianjorgensen/json-flat-select#readme
- Issues: https://github.com/ianjorgensen/json-flat-select/issues
- npm.io page: https://npm.io/package/json-flat-select

## Dependencies (3)

- [argv](https://npm.io/package/argv.md) 0.0.2
- [glob](https://npm.io/package/glob.md) ^7.1.2
- [folder-walker](https://npm.io/package/folder-walker.md) ^3.1.0

## Recent versions

- 1.2.1 (latest) — 2018-03-21
- 1.2.0 — 2018-03-21
- 1.1.1 — 2018-03-12
- 1.1.0 — 2018-03-12
- 1.0.0 — 2018-03-12

## README

# 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
```sh
npm install -g json-flat-select
```

## Map.json

```json
{
  "name": "name", //address a root property
  "age": "info.more.age" // access sub property, '' if not defined
  "result1": "results[0].value" // access index, '' if out of range
  "resultFallback": ["results[0].value","results[0].error"] // if not defined will attempt to resolve second
}
```

## Command Line Usage

```sh
json-flat-select ./**/*.json pathToRowMapFile > data.json
json-flat-select ./**/*.json pathToRowMapFile ',' > data.csv
json-flat-select ./**/*.json pathToRowMapFile '\t' > data.tsv
```


## Module Usage

```js
var jsonFlatSelect = require('json-flat-select')
var rowMap = require('PUT_PATH_TO_ROW_MAP_HERE.json')

var csvTable = jsonFlatSelect('*.json', rowMap)
```


## Test

```js
npm test
```

---
_Source: https://npm.io/package/json-flat-select · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
