Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

native JSONC parsing #12402

Open
2 tasks done
aster-void opened this issue Feb 3, 2025 · 0 comments
Open
2 tasks done

native JSONC parsing #12402

aster-void opened this issue Feb 3, 2025 · 0 comments
Labels
feature Feature request or proposal

Comments

@aster-void
Copy link

aster-void commented Feb 3, 2025

Is your feature request related to a problem

nix can't natively parse JSONC.

more specifically, I had to manually remove trailing commas from bun.lock to parse it into nix object.

Proposed solution

add builtin function builtins.fromJSONC

JSONC doesn't have "one universal standard", but it's generally assumed to be JSON superset with C-style comments (// and /* */) and trailing commas allowed (but not required)

Alternative solutions

  1. add support for JSON5, which is superset of JSONC and has a universal standard https://json5.org/
  2. use some package from nixpkgs to parse it (IFD)
  3. manually remove comments and trailing commas from JSONC to then parse with builtins.fromJSON

Additional context

Checklist


Add 👍 to issues you find important.

@aster-void aster-void added the feature Feature request or proposal label Feb 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature Feature request or proposal
Projects
None yet
Development

No branches or pull requests

1 participant