Socket
Socket
Sign inDemoInstall

nosj

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nosj

JSON serializer and deserializer for simple JSON objects.


Version published
Maintainers
1
Created
Source

nosj Build Status

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);
//=> {"string":"hello","number":13,"float":3.14,"date":"1982-01-13T05:00:00.000Z","array":[{"a":"a"},{"b":"b"}],"object":{"x":"x","y":"y"}}

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);
//=>
// {
//   string: 'hello',
//   number: 13,
//   float: 3.14,
//   date: Wed Jan 13 1982 00:00:00 GMT-0500 (EST),
//   array: [ { a: 'a' }, { b: 'b' } ],
//   object: { x: 'x', y: 'y' }
// }

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

Keywords

FAQs

Package last updated on 18 May 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc