js-object-parser
A library for parsing a string to a javascript object.
Main difference between the JSON.parse function and this function is that js-object-parser will be able to parse
"{A:b, C:d, E:{any-object:{a:1, b:2}}}"
, where JSON.parse fails as it requires every property to be wrapped in quotationmarks, i.e:
"{"A":"b", "C":"d", "E":{"any-object":{"a":1, "b":2}}}"
Example / Usage
Add it to your project by
npm install js-object-parser
In your program
; console;//Outputs: {A: "b", C: [1,2,"3"]}
It can handle nested objects:
console;//Outputs: { A: { BCDEF: { G: "h" }, I: "j" } }
Test
For testing, run
# Clone repository
git clone https://github.com/simonlovesyou/js-object-parser.git
# Navigate into project folder
cd js-object-parser
# Install dependencies
npm install
# Run tests
npm test
Creator
License (MIT)
Copyright (c) 2015 Simon Johansson