Skip to content

Object.parse is enhanced version of JSON.parse with extra support for functions inside stringified object.

License

Notifications You must be signed in to change notification settings

MarekZeman91/Object.parse

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 

Repository files navigation

Object.parse

Object.parse is enhanced version of JSON.parse with extra support for functions inside stringified object.

Usage:

Parse complex object with function.

var obj = '{' +
'   "string": "string",' +
'   "number": 999,' +
'   "object": {' +
'       "array": [' +
'           "abcd",' +
'           1234,' +
'           true,' +
'           null,' +
'           null' +
'       ],' +
'       "boolean": false' +
'   },' +
'   "boolean": true,' +
'   "function": "function FN(a, b, c) {a += b; c += b; return a * c;}"' +
'}';
 
var result = Object.parse(obj);
 
/*
result = {
    string: 'string',
    number: 999,
    object: {
        array: ['abcd', 1234, true, null, null],
        boolean: false
    },
    boolean: true,
    function: function FN(a, b, c) {
        a += b; c += b;
        return a * c;
    }
}
*/

About

Object.parse is enhanced version of JSON.parse with extra support for functions inside stringified object.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published