# fast-json-parse

> Parse json safely and at max speed

Latest version **1.0.3** (published 2017-07-30) · MIT license · 0 weekly downloads

## Install

```sh
npm install fast-json-parse
pnpm add fast-json-parse
yarn add fast-json-parse
bun add fast-json-parse
```

## 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.3 |
| Published | 2017-07-30 |
| First published | 2016-02-22 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 91 |
| Author | Matteo Collina |
| Maintainers | matteo.collina |
| Keywords | parse, json, fast, safe |

## Links

- npm: https://www.npmjs.com/package/fast-json-parse
- Repository: https://github.com/mcollina/fast-json-parse
- Homepage: https://github.com/mcollina/fast-json-parse#readme
- Issues: https://github.com/mcollina/fast-json-parse/issues
- npm.io page: https://npm.io/package/fast-json-parse

## 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

- 1.0.3 (latest) — 2017-07-30
- 1.0.2 — 2016-05-26
- 1.0.1 — 2016-04-13
- 1.0.0 — 2016-02-22

## README

# fast-json-parse

[![Build Status](https://travis-ci.org/mcollina/fast-json-parse.svg)](https://travis-ci.org/mcollina/fast-json-parse)

It is equivalent to [json-parse-safe](http://npm.im/json-parse-safe),
but it set both the `err` and `value` property to null.

The reason why this is fast is that `try/catch` inhibits the functions
in which you use them to be optimized. This assumption holds true up to
Node 6, from Node 7 and forward this module is not useful anymore.

## Install

```
npm i fast-json-parse --save
```

## Usage

You can use it as a function or via a contructor, as you prefer.

### function

```js
'use strict'

var parse = require('fast-json-parse')
var fs = require('fs')

var result = parse(fs.readFileSync('./package.json'))

if (result.err) {
  console.log('unable to parse json', result.err.message)
} else {
  console.log('json parsed successfully', result.value)
}
```

### constructor

```js
'use strict'

var Parse = require('fast-json-parse')
var fs = require('fs')

var result = new Parse(fs.readFileSync('./package.json'))

if (result.err) {
  console.log('unable to parse json', result.err.message)
} else {
  console.log('json parsed successfully', result.value)
}
```

## Acknowledgements

fast-json-parse is sponsored by [nearForm](http://nearform.com).

## License

MIT

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