DEV Community

Cover image for fast-json-format: Format JSON Without Data Loss
jQueryScript
jQueryScript

Posted on

fast-json-format: Format JSON Without Data Loss

fast-json-format is a JavaScript library that pretty-prints JSON strings without parsing them, which means you can format JSON containing BigInt literals without losing precision. The library handles these scenarios:

  • Preserves BigInt values like 12345678901234567890n that would break JSON.parse
  • Keeps decimal formatting intact (1.2300 stays 1.2300)
  • Tolerates malformed JSON instead of throwing errors
  • Zero dependencies, single file implementation

Check it out if you're working with APIs that return large integers or need to format JSON-like strings from logs where syntax might be imperfect.

๐Ÿ‘‰ Blog Post

๐Ÿ‘‰ GitHub Repo

๐Ÿ‘‰ Live Demo

Top comments (0)