# irrelon-json-to-csv

> Converts one or more JSON files to CSV files based on dot notation paths to data.

Latest version **1.0.0** (published 2019-02-13) · ISC license · 0 weekly downloads

## Install

```sh
npm install irrelon-json-to-csv
pnpm add irrelon-json-to-csv
yarn add irrelon-json-to-csv
bun add irrelon-json-to-csv
```

## 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.0.0 |
| Published | 2019-02-13 |
| First published | 2019-02-13 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 4.7 KB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| Maintainers | coolbloke1324 |

## Links

- npm: https://www.npmjs.com/package/irrelon-json-to-csv
- npm.io page: https://npm.io/package/irrelon-json-to-csv

## Dependencies (1)

- [irrelon-path](https://npm.io/package/irrelon-path.md) ^1.0.2

## Recent versions

- 1.0.0 (latest) — 2019-02-13

## README

# JSON to CSV
Converts a JSON or group of JSON files to CSV files based on a field definition.

# Install
```bash
npm i irrelon-json-to-csv
```

# Usage
Create a field definition .js file. This will export (via commonjs / node.js module standard)
an object describing the keys and paths to the data to export as csv.

Field Definition File (exampleFields.js)
```js
module.exports = [{
	title: 'User ID',
	path: `id`
}, {
	title: 'Email Address',
	path: `user.auth.email`,
	transform: (data) => {
		return data.replace(/'/g, '');
	}
}];
```

Given a json file with an array of objects (exampleData.json)
```json
[{
	"id": "1",
	"user": {
		"auth": {
			"email": "'foo@bar.com'"
		}
	}
}]
```

Running from command line:
```bash
cd irrelon-json-to-csv
node index.js ./exampleFields.js ./exampleData.json
```

The output will be a CSV file (output_1.csv):
```csv
User ID,Email Address
1,foo@bar.com
```

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