Parse, Stringify And Compress JSON Strings With JavaScript – zipson

Category: Javascript , Recommended | October 31, 2018
Author: jgranstrom
Views Total: 531
Official Page: Go to website
Last Update: October 31, 2018
License: MIT

Preview:

Parse, Stringify And Compress JSON Strings With JavaScript – zipson

Description:

zipson is a fast JavaScript JSON parse & stringify library that supports efficient, convenient JSON compression.

Basic usage:

Install the zipson with NPM.

# NPM
$ npm install zipson --save

Stringify any data to a string.

import { stringify } from 'zipson';

const myData = []; // JSON data here
const stringified = stringify(myData, options);

Stringify any data to a zipson writer.

import { stringifyTo, ZipsonStringWriter } from 'zipson';

const writer = new ZipsonStringWriter();
const myData = []; // JSON data here
stringifyTo(myData, writer, options);
const stringified = writer.value;

Parse a zipson data string

import { parse } from 'zipson';

const myData = ''; // stringified data here
const parsed = parse(myData);

Incrementally parse a zipson data string in chunks.

import { parseIncremental } from 'zipson';

const increment = parseIncremental();
increment(StringifiedData1);
increment(StringifiedData2);
increment(StringifiedData3);
increment(StringifiedData4);
const parsed = increment(null);

Changelog:

v0.2.10

  • compressor: fix integer overflow for large floats with reduced precision

You Might Be Interested In:

Leave a Reply