nosj
JSON serializer and deserializer for simple JSON objects.
Install
$ npm install --save nosj
Usage
var nosj = require('nosj');
var obj = {
string: 'hello',
number: 13,
float: 3.14,
date: new Date('01/13/1982'),
array: [
{a: 'a'},
{b: 'b'}
],
object: {
x: 'x',
y: 'y'
}
};
nosj.serialize(obj);
var string = '{"string":"hello","number":13,"float":3.14,"date":"1982-01-13T05:00:00.000Z","array":[{"a":"a"},{"b":"b"}],"object":{"x":"x","y":"y"}}'
nosj.deserialize(string);
API
serialize(object)
Serialize a string back into JSON
deserialize(string, [options])
Deserialize a string back into JSON
options
stringToDates
Type: boolean
Default: true
Convert all ISO 8601 date formatted strings to a Date
.
License
MIT © Blain Smith