Skip to content
/ dered Public

Remove redundant keys in JSON-data during transmission to reduce size.

License

Notifications You must be signed in to change notification settings

EisFrei/dered

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

dered

Deredundantize JSON data before transmitting it.

Useful when you have a huge array containing the same datastructure over and over again.

[
	{
		"long_key1": "value1",
		"long_key2": "value2"
	},
	{
		"long_key1": "value3",
		"long_key2": "value4"
	},
	[…]
	{
		"long_key1": "value7",
		"long_key2": "value8"
	},
	{
		"long_key1": "value9",
		"long_key2": "value10"
	}
]

becomes

{
	"δ": [
		["long_key1", "long_key2"],
		[
			["value1", "value2"],
			["value3", "value4"],
			["value7", "value8"],
			["value9", "value10"]
		]
	]
}

Usage

Install

npm i dered

Require

const dered = require('dered');

Remove redundancies

var less_data = dered.encode(json);

Re-add redundancies

var more_data = dered.decode(less_data);

Do NOT use δ as key in the source data!

About

Remove redundant keys in JSON-data during transmission to reduce size.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published