@lasthosi/json
v0.0.77
Published
在json基础上, 扩展了bigint类型和自定义的BigNum类型, 对boolean, null等做了替换
Downloads
124
Maintainers
Readme
#json 在JSON对象基础上,增强对bigint、Date、BigNum(@lasthosi/math)等的支持,true->t, false->f, null->n,parse时可以正确还原类型。 例: {a:10n,b:new Date(),c:bignum(1001n,-2n),d:true,e:false,f:null} -> {"a":10n,"b":2023-07-22T17:50:00.321Z,"c":1001e-2b,"d":t,"e":f,"f":n}
调用: json.parse("{}"); // {} json.stringify({}); // "{}"
[2023/08/04]0.0.7 添加buffer支持,采用16进制表示,首尾使用x作为标记,解析时不区分16进制字母大小写,序列化时使用小写字母,如:xff010200x
[2023/07/22]0.0.2 为json.parse添加范型标注:json.parse<T = any>(input:string):T;