get-if-has-json
v2.0.10
Published
Extract JSON from a string that contains a bunch of crap before or after a valid JSON Object.
Downloads
28
Readme
get-if-has-json
THIS PACKAGE IS A JOKE AND IS NOT TO BE USED FOR ACTUAL APPLICATIONS. IF YOU NEED THIS PACKAGE, ONLY GOD HIMSELF CAN GET YOU OUT OF IT.
Extract JSON from a string that contains a bunch of crap before or after a valid JSON Object.
Install
npm i get-if-has-json
Usage
const json = require('get-if-has-json')
json('foo { } bar')
// Output: {}
API
Parameters
str
{String}
String that contains a JSON object.
Returns
{Object}
Parsed JSON.