1.1.2 • Published 10 months ago

@madhavanand/object-string-to-object v1.1.2

Weekly downloads
-
License
MIT
Repository
github
Last release
10 months ago

JS Object String to JS Object

A npm package that converts/parses the JavaScript Object in String Type to JavaScript Object.

Input : JavaScript Object as String Type
Output : JavaScript Object

The Problem

Example

Object Strings Failed to parse

const objString = "{ url : 'http://google.com' }"
const objString = "{ 'url' : 'http://google.com' }"

How to use

// Import
const customParser = require('object-string-to-object')  

// Test String
const objString = '{ url : "http://google.com" }';  

// Output
const result = customParser(objString);  

For a correct input, output is 100% correct.
For an incorrect input, you may get an undesired output/error.
For an Error, null is returned.