json-length
v1.0.0
Published
Calculate length of stringified json without JSON.stringify
Downloads
3
Readme
json-length
Calculate length of stringified json without JSON.stringify
.
const jsonLength = require("json-length");
const json = { ... };
const length = jsonLength(json);
// result of `jsonLength(json)` is equal to `JSON.stringify(json).length`
const jsonStringifyLength = JSON.stringify(json).length;
if(length === jsonStringifyLength){
console.log("jsonLength(json) === JSON.stringify(json).length");
}
License
MIT