# 2json

> json flattener that outputs lines similar to xml2

Latest version **0.2.1** (published 2016-12-02) · ISC license · 0 weekly downloads

## Install

```sh
npm install 2json
pnpm add 2json
yarn add 2json
bun add 2json
```

Provides the commands `2json`, `json2`.

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.2.1 |
| Published | 2016-12-02 |
| First published | 2016-12-01 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Author | prussian |
| Maintainers | prussian |
| Keywords | xml2, json2 |

## Links

- npm: https://www.npmjs.com/package/2json
- Repository: https://github.com/GeneralUnRest/json2
- Homepage: https://github.com/GeneralUnRest/json2#readme
- Issues: https://github.com/GeneralUnRest/json2/issues
- npm.io page: https://npm.io/package/2json

## Dependencies (1)

- [lodash.mergewith](https://npm.io/package/lodash.mergewith.md) ^4.6.0

## Alternatives

- [@mapbox/jsonlint-lines-primitives](https://npm.io/package/@mapbox/jsonlint-lines-primitives.md) — 5.3M weekly downloads
- [reftools](https://npm.io/package/reftools.md) — 3.5M weekly downloads
- [@hey-api/openapi-ts](https://npm.io/package/@hey-api/openapi-ts.md) — 3.5M weekly downloads
- [@mapbox/geojson-rewind](https://npm.io/package/@mapbox/geojson-rewind.md) — 2.4M weekly downloads
- [turbo-stream](https://npm.io/package/turbo-stream.md) — 1.7M weekly downloads

## Recent versions

- 0.2.1 (latest) — 2016-12-02
- 0.2.0-readme1 — 2016-12-02
- 0.2.0 — 2016-12-02
- 0.1.0 — 2016-12-01
- 0.0.2 — 2016-12-01
- 0.0.1 — 2016-12-01

## README

json2
=====

simple utility for transforming json documents into grep-able and sed-able lines

install
-------

    # json2 was already taken
    npm install -g 2json

usage
-----

    # json2 args
    json2 [file] [< or_file]

    # 2json
    # -p flag pretty prints json
    2json [file] [< or_file] [-p --pretty]

    # get package name
    basename $(json2 package.json | grep '/name')

    # change package name and reconvert lines to json using 2json
    json2 < package.json | sed 's@\(/name\)/.*@\1/new-name@' | 2json -p

escapes for json2/2json
-----------------------

The following are escaped--by being in quote strings, as per rules:
 
  * all forward slashes (/)
  * all index brackets ([ or ])
  * all strings that are just number characters (e.g. 00193425)

You must escape double quotes in strings, json2 does this.

backslash escapes for 2json
---------------------------

The following characters must be escaped to handle issues with newlines using backslashes, whether in quotes or not:

    \ <- escape as \\
    \n
    \r
    \f

notes
------

/ [ ] are reserved by the json line grammar, if such values are found in your json, they will be quoted in double quotes.

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