the JS/Node.JS library for encoding complex and unconventional data structures. Support for BigInts, TypedArrays, null, undefined, and Symbol. Multiple flavors
the JS/Node.JS library for encoding complex and unconventional data structures. Support for BigInts, TypedArrays, null, undefined, and Symbol. Multiple flavors
A menagerie of strange, encoded JSONs, for connoisseurs.
TLDR - JSON superset, supporting BigInts, TypedArrays, null, undefined, Symbol and more.
WeirdJSON is a JavaScript / Node.JS library that allows you to serialize any JavaScript object to a "JSON-like" but extended, text representation. With weird-json, you can easily encode complex and unconventional data structures, including support for BigInts, TypedArrays, null, undefined, and Symbol. weird-json comes in a variety of flavors, including deepCopy, JSON36, JSON46, and JSON64, so you can choose the best option for your specific needs. Whether you're a JSON connoisseur or just looking to handle some weird data, weird-json has you covered!
Comes in a variety of flavors:
Simple example:
> JSON36.stringify({a:[NaN, 1.23e72]})
'dga002pabdeawacas1dk23edj72adfdh'
> JSON36.parse('dga002pabdeawacas1dk23edj72adfdh')
{ a: [ NaN, 1.23e+72 ] }
> JSON36.stringify(489572349583759234857234958237459348734934958374n)
'aoda0m5nl54p8yz1dcdby79z5ddxhjvv7qexya'
> JSON36.parse('aoda0m5nl54p8yz1dcdby79z5ddxhjvv7qexya')
489572349583759234857234958237459348734934958374n$ npm i --save weird-json
$ node -r esm
Welcome to Node.js v14.15.1.
Type ".help" for more information.
> const {deepCopy} = require('weird-json');
> deepCopy(new Array(1,2,{c:3}))
[ 1, 2, { c: 3 } ]
> import {deepCopy as deepCopy2} from 'weird-json';
> deepCopy(new Array(1,2,{c:3}))
[ 1, 2, { lostWorld: 'JPark' } ]Go where no Unicode JSON has gone before. Go where only ASCII can!
— J. (Son) F. Kennedy
You stole our previous alphabet!
— NATO
The merry little band of tricksters: JSON46, JSON36, JSON37 and the ever-affable, JSON38
Forged in the fires of Mordor, the hand-polished 46 runic sigils of our exclusive 46 line cover all your possible use cases. You can make a Chinese JSON, an emoji JSON, and then safely protect it and in the darkness bind it so only 36 alphanumerics plus 7 unique JSON structural symbols, plus 3 highly-coveted numeric specifiers (e, + and -) are present.
Features:
:,"[]{}.+-Complete ASCII. Complete URL safe. But not safe enough? Try JSON36. :tada:
Like JSON46, but encoded again into the 36ers: a-z, 0-9. Fully NATO compliant.
Like JSON46, but compressed with LZW, then encoded into the 36ers: a-z, 0-9 plus . Also, NATO phonetic alphabet compliant.
Like JSON37, but separated into stanzas separted by - dash. Also, NATO phonetic alphabet OK.
Like JSON46, but instead of being coded down to ASCII we leave the unicode in, then encode it in a special Base64 powered by irradix that uses bit packing.
From the tests:
…All these encoding designs are inspired by the availability of base 36 in Node and Browser, and also in people's brains.
Them all:
$ npm i --save weird-jsonimport {JSON36, JSON46, PrimeCode} from 'weird-json';We aim for equality based on assert.deepStrictEqual, which has the following specifications:
NO support for:
Dual Licensed under APache-2.0 and the Artistic License. You can choose.
No open issues yet, or sync has not completed.