# err-json

> Convert Error to JSON

Latest version **0.1.0** (published 2019-05-31) · MIT license · 0 weekly downloads

## Install

```sh
npm install err-json
pnpm add err-json
yarn add err-json
bun add err-json
```

## 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.1.0 |
| Published | 2019-05-31 |
| First published | 2017-07-12 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 2.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Kengo Nakatsuka |
| Maintainers | nak2k |
| Keywords | error, json |

## Links

- npm: https://www.npmjs.com/package/err-json
- Repository: https://github.com/nak2k/node-err-json
- Issues: https://github.com/nak2k/node-err-json/issues
- npm.io page: https://npm.io/package/err-json

## 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.1.0 (latest) — 2019-05-31
- 0.0.4 — 2018-03-28
- 0.0.3 — 2017-07-12
- 0.0.2 — 2017-07-12
- 0.0.1 — 2017-07-12

## README

# err-json

Convert Error to JSON.

## Installation

```
npm i err-json
```

## Usage

``` javascript
const {
  errJson,
  errJsonDebug,
} = require('err-json');

const json1 = errJson(err);

const json2 = errJson(err, true);
```

## errJson(err)

Returns an object with the following properties:

- `name`
    - A name of the error.
- `message`
    - Error message.
- `code`
    - Error code.

## errJsonDebug(err, split = false)

Returns an object with the following properties:

- `name`
    - A name of the error.
- `message`
    - Error message.
- `code`
    - Error code.
- `stack`
    - Stack trace.
    - If the argument `split` is true, it is returned as an array.

## License

MIT

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