Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/johnhof/parse-types

Parse types of nested javascript strings
https://github.com/johnhof/parse-types

Last synced: 20 days ago
JSON representation

Parse types of nested javascript strings

Awesome Lists containing this project

README

        

# parse-type

[![Build Status](https://travis-ci.org/johnhof/parse-types.svg?branch=master)](https://travis-ci.org/johnhof/parse-types)

Parse types of nested javascript strings

# Usage

```
let parse = require('parse-types');

let result;

// String
result = parse("{"test":"1","another":"false","nope":"tru","float":"0.1","nested":{"property":{"number":"10"}},"array":["of","0",{"various":"10","values":"sad"}]}");

// OR

// Object
result = parse({
test: '1',
another: 'false',
nope: 'tru',
float: '0.1',
nested: {
property: {
number: '10'
}
},
array: [
'of',
'0',
{
various: '10',
values: 'sad'
}
]
});

console.log(result);
/*

{
"test": 1,
"another": false,
"nope": "tru",
"float": 0.1,
"nested": {
"property": {
"number": 10
}
},
"array": [
"of",
0,
{
"various": 10,
"values": "sad"
}
]
}

*/

```

# Authors

- [John Hofrichter](https://github.com/johnhof)