webdiff
webdiff copied to clipboard
Normalize JSONC / JSON5 files
With #237 webdiff normalizes JSON files for indentation and key order. But lots of JSON files are actually JSONC or JSON5. It would be nice to normalize these, too.
The only library I could find for preserving comments in the parse↔serialize roundtrip was comment-json, which is TypeScript. I really do want a Python library, though. There’s a long-standing feature request to add this to pyjson5.
Another idea would be to use prettier, which can normalize JSONC. But it doesn’t sort keys and probably never will. It would also be awkward to bundle prettier with a Python tool.