Comment-Preserving JSON/JSON5 Writer

JSON →
library 0.2.0 ·javascript
verified May 27, 2026

json5-writer is a JavaScript utility designed to parse and modify JSON and JSON5 files while meticulously preserving comments, whitespace, and original formatting. Unlike typical JSON parsers that discard non-data elements, this library converts JSON5 input into a JavaScript Abstract Syntax Tree (AST) using jscodeshift, allowing programmatic updates to values without disturbing surrounding comments or formatting. It is particularly useful for configuration file management where human-readable comments are critical. The current stable version is 0.2.0. The package does not explicitly state its release cadence, but its unique AST-based approach provides fine-grained control over output, distinguishing it from simpler JSON modification tools. It supports both JSON and JSON5 syntax for input and can output standard JSON or JSON5 with configurable options for quoting and trailing commas.

total hits 48
actors 9 distinct systems
last hit 21h ago human
ByteDance
5
Amazonbot
4
MetaBot
4
GPTBot
2
Script
1
Search engines
2
Humans
8

top countries 🇨🇦 Canada · 🇺🇸 United States · 🇸🇬 Singapore · VN · CO