百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
W

WeirdJSON

> DevOps
开源

用于编码复杂和非传统数据结构的 JS/Node.js 库。支持 BigInt、TypedArrays、null、undefined 和 Symbol。多种风格

200 stars0 点赞1 次浏览
访问官网GitHub

工具介绍

用于编码复杂和非传统数据结构的 JS/Node.js 库。支持 BigInt、TypedArrays、null、undefined 和 Symbol。多种风格

:blue_heart: weird json

A menagerie of strange, encoded JSONs, for connoisseurs.

what?

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!

features

Comes in a variety of flavors:

  • deepCopy - clones an object as deeply as possible. (Limitations: No support for functions because of closure inequality, no preservation of prototype chain for custom objects but all JavaScript builtin objects supported on the browser are handled (but not DOM/CSSOM API objects like Node, or XMLHttpRequest, CSSStyleSheetDeclaration), no cloning of unregistered Symbols (i.e, not created with Symbol.for), no support for WeakSet nor WeakMap. See limitationisms for details.
  • JSON36 - JSON46 but coded down to (case-insensitive) A-Z0-9
  • JSON46 - Supports the full 17-plane Unicode 13, and codes it down to ASCII without Base64. HUZZAH!
  • JSON64 - JSON46 but encoded with irradix to a special base64

Simple example:

javascript
> JSON36.stringify({a:[NaN, 1.23e72]})
'dga002pabdeawacas1dk23edj72adfdh'
> JSON36.parse('dga002pabdeawacas1dk23edj72adfdh')
{ a: [ NaN, 1.23e+72 ] }
> JSON36.stringify(489572349583759234857234958237459348734934958374n)
'aoda0m5nl54p8yz1dcdby79z5ddxhjvv7qexya'
> JSON36.parse('aoda0m5nl54p8yz1dcdby79z5ddxhjvv7qexya')
489572349583759234857234958237459348734934958374n

usagistics

bash
$ 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' } ]

testimoanials


Go where no Unicode JSON has gone before. Go where only ASCII can!

— J. (Son) F. Kennedy


You stole our previous alphabet!

— NATO

get to know the current JSONs-in-residence

The merry little band of tricksters: JSON46, JSON36, JSON37 and the ever-affable, JSON38

JSON46

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:

  • alphabet: a-z, 0-9, :,"[]{}.+-
  • JSON superset, supports BigInt, TypedArrays, null, undefined and Symbol

Complete ASCII. Complete URL safe. But not safe enough? Try JSON36. :tada:

JSON36

Like JSON46, but encoded again into the 36ers: a-z, 0-9. Fully NATO compliant.

JSON37

Like JSON46, but compressed with LZW, then encoded into the 36ers: a-z, 0-9 plus . Also, NATO phonetic alphabet compliant.

JSON38

Like JSON37, but separated into stanzas separted by - dash. Also, NATO phonetic alphabet OK.

JSON64

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.

examplings

From the tests:

…

designagistics

  • can I have a JSON format that effortlessly supports Unicode everywhere without any problems?
  • can I have a text and coding format to make everything ASCII for transport that isn't affected by different apis for base64 in node JS and the browser?
  • can I have a JSON that supports Bigints and typed arrays as well as null undefined and symbols?
  • is there a encoding to ASCII text that I can easily access in JavaScript in the browser and in node without writing it myself nor importing a dependency?
  • what if I want to say JSON over the telephone or radio?

All these encoding designs are inspired by the availability of base 36 in Node and Browser, and also in people's brains.

get

Them all:

bash
$ npm i --save weird-json

usagisms

javascript
import {JSON36, JSON46, PrimeCode} from 'weird-json';

technicalisters

We aim for equality based on assert.deepStrictEqual, which has the following specifications:

  • Primitive values are compared using the SameValue Comparison, used by Object.is().
  • Type tags of objects should be the same.
  • [[Prototype]] of objects are compared using the Strict Equality Comparison.
  • Only enumerable "own" properties are considered.
  • Error names and messages are always compared, even if these are not enumerable properties.
  • Enumerable own Symbol properties are compared as well.
  • Object wrappers are compared both as objects and unwrapped values.
  • Object properties are compared unordered.
  • Map keys and Set items are compared unordered.
  • Recursion stops when both sides differ or both sides encounter a circular reference.
  • WeakMap and WeakSet comparison does not rely on their values. See below for further details.

roadiest mappings

  • add support for BigInt
  • add support for NaN, Infinity, null and undefined
  • add typedarray support
  • support floating point exponent notification
  • add symbol support
  • add support for Map and Set
  • Add support for Date
  • add deepCopy
  • implement json37, and json38
  • optimize speed
  • support Node.JS built-ins like Buffer, etc
  • revive prototype chain for instances of custom class or prototypal inheritance

preeori artus / anteeori artusismus

  • yuwu9145/nest-object-deep-copy doesn't support everything but supports cloning prototypes (:astonished:)

limitationisms

NO support for:

  • WeakSet nor WeakMap, because values collected in these will have no other references on revivial, and so will not make sense to be in WeakMap nor WeakSet, and will not be guaranteed to be in there. Explore if you can use Map or Set instead.
  • unregistered Symbols. Because these will fail the equality test (DeepStrictEquality), by design of Symbol. Use registered Symbol's (Symbol.for) instead.
  • Functions. Because scope cannot be serialized in JavaScript at this time, and also because functions fail the equality test (DeepStrictEquality)

licensing

Dual Licensed under APache-2.0 and the Artistic License. You can choose.

Issues· 6 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

JavaScriptasciiascii85base64emoji

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月18日
分类DevOps
定价开源

> 相关工具

D
Docker
容器化平台,标准化应用交付
G
GitHub Actions
GitHub 原生 CI/CD 工作流
N
Nginx
高性能 Web 服务器与反向代理