Skip to content

Normalize JSONC / JSON5 files #238

Description

@danvk

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions