serialize-json
A serialize algorithm for JSON
Introduction
-
Support serialize JSON to Buffer, and deserialize Buffer to JSON
- [√] Boolean
- [√] String
- [√] Number
- [√] Null
- [√] Undefined
- [√] Date
- [√] Buffer
- [√] Error
- [√] Plain Object
- [×] Function
- [×] RegExp
- [×] Symbol
-
Inspire by jsonpack, it can compress to 55% of original size if the data has a recursive structure
Install
$ npm install serialize-json --save
Node.js >= 4.0.0 required
Usage
let json = a: 'a' b: 123 c: 123456 d: 1 2 3 e: true f: null g: undefined h: i: 'this is a buffer' j: 'this is a error';const buf = JSON;const result = JSON;assert;
API
encode(json)
serialize a json objectdecode(buf)
deserialize a buffer to json