Skip to content

Instantly share code, notes, and snippets.

@kirpalmakanga
Last active January 18, 2018 14:19
Show Gist options
  • Save kirpalmakanga/1a5ce942f90f19cd77846a44bf6875d7 to your computer and use it in GitHub Desktop.
Save kirpalmakanga/1a5ce942f90f19cd77846a44bf6875d7 to your computer and use it in GitHub Desktop.
Get json string size
const bytes = (s) => ~-encodeURI(s).split(/%..|./).length;
const jsonSize = (s) => bytes(JSON.stringify(s));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment