Skip to content

Extract JSON from a string that contains a bunch of crap before or after a valid JSON Object.

License

Notifications You must be signed in to change notification settings

de-ar/get-if-has-json

Repository files navigation

get-if-has-json

Tests Coverage Status Latest Stable Version NPM Downloads

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.

About

Extract JSON from a string that contains a bunch of crap before or after a valid JSON Object.

Resources

License

Stars

Watchers

Forks

Packages

No packages published