@madhavanand/object-string-to-object

1.1.2 • Public • Published

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

image

Example

Object Strings Failed to parse

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

image

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.

Package Sidebar

Install

npm i @madhavanand/object-string-to-object

Weekly Downloads

0

Version

1.1.2

License

MIT

Unpacked Size

3.04 kB

Total Files

3

Last publish

Collaborators

  • madhavanand