json-try-parse
Version:
try to parse json or return undefined
22 lines (14 loc) • 323 B
Markdown
Try to parse json, or return undefined. I just wrote this too many times so it
had to become a module
```sh
npm install json-try-parse --save
```
```js
var tryParse = require('json-try-parse');
var obj = tryParse('{ "hello": "there" }');
console.log(obj.hello);
// "there"
```