sjson
Squishable JSON strings. To assist with JSON compression by stripping variable name double quotes and yet the squished strings can still be parsed by javascript.
Install 🔨
npm install sjson
Usage 🔧
var SJSON = ; var data = first:"joe" last:"smith" age:27;var json = JSON;var sjson = SJSON;var json2 = SJSON;var data2 = JSON; console; // {"first": "joe", "last": "smith", "age": 27}console; // {"first":"joe","last":"smith","age":27}console; // {first:"joe",last:"smith",age:27}console; // {"first":"joe","last":"smith","age":27}console; // {"first": "joe", "last": "smith", "age": 27}
While it may not look like much, every byte helps when you scale :-) In this example we get at 15% headstart on any addition compression we may want to do.
Directly operate with objects 🔧
sjson = SJSON; // do both JSON.stringify and SJSON.squishdata2 = SJSON; // do both SJSON.unsquish and JSON.parse console; // {"first": "joe", "last": "smith", "age": 27}console; // {first:"joe",last:"smith",age:27}console; // {"first": "joe", "last": "smith", "age": 27}
Generate browser callbacks 🔧
out = SJSON; // function wrapped SJSON.squishifyconsole; // callme({first:"joe",last:"smith",age:27});