[FEATURE] Support JSONC format for settings files (settings.jsonc)

Open 💬 18 comments Opened Jan 13, 2026 by PaulRBerg

Problem

JSON doesn't support comments, making it difficult to document configuration decisions in settings.json. As noted in #4475, users resort to unofficial keys like _comment for documentation purposes.

Rather than adding a custom description field, a more standard solution would be to support JSONC (JSON with Comments) - the same format used by VS Code's settings.json, tsconfig.json, and many other developer tools.

Proposed solution

  1. Update the settings parser to accept JSONC syntax (allow // and /* */ comments)
  2. Optionally support settings.jsonc as an alternative filename (with precedence over settings.json)
  3. Update documentation to reflect JSONC support

Example usage:

{
  "hooks": {
    "PostToolUse": [
      {
        // Validates JSON output from sub-agents against our protocol schema
        "matcher": "Task",
        "hooks": [
          {
            "type": "command",
            "command": ".claude/hooks/validate_agent_output.sh"
          }
        ]
      }
    ]
  },
  "permissions": {
    // Allowlist essential CI commands but block all network access
    "allow": ["Bash(npm run test:*)"],
    "deny": ["WebFetch"]
  }
}

Alternatives considered

  • Custom description field (#4475): Works but non-standard; requires Claude Code-specific parsing and doesn't match how other tools handle JSON configuration
  • _comment keys: Currently works since unknown keys are ignored, but undocumented and inconsistent

Priority

Medium

Category

Configuration and settings

View original on GitHub ↗

18 Comments

mieubrisse · 6 months ago

Adding that this would be very useful for me - my settings.json is starting to get large, and I'd like to document why I made certain deny choices. Since deny is an array (not an object), the "use a key like // for comments" approach doesn't work.

HustCoderHu · 5 months ago

need this too~

Notmeomg · 5 months ago

+1

ashwingopalsamy · 5 months ago

We'd greatly value having this feature, especially in Enterprise settings, where the leadership team can create comments on the settings.jsonc that plainly emphasise what means what and why it matters.

devnulled · 5 months ago

+1, having comments in configuration files is important, especially when using in a team environment where you are trying to get everyone on the same page.

panchr · 4 months ago

+1

Alternatively, supporting YAML or TOML would make the config easier to manage as well (and support comments natively)

G-S-Paris · 4 months ago

+1!! it'd be great have inline documentation of permission groups

alester-fss · 4 months ago

Amen to YAML. In our codebase, our rule is YAML for configs, and JSON only for data serialization.

bmillwood-aisi · 3 months ago

if you do keep json as the configuration language, maybe you should just skip directly to json5?

paaloeye · 3 months ago

Personally, I'd prefer keeping settings.json (not settings.jsonc or settings.json5) for backward compatibility but allow comments. That's what VS Code does with _jsonc_ mode.

Amen to YAML. In our codebase, our rule is YAML for configs, and JSON only for data serialization.

Oh no, YAML is a horrible choice.

x8x · 3 months ago

Adding my voice here — this is one of those small changes that would have an outsized impact on daily workflow.

As someone who maintains fairly complex settings across user, project, and local scopes (hooks, permissions, MCP servers, env vars), the inability to annotate why a particular rule exists is a real pain point. I end up keeping the rationale in my head or in a separate doc that inevitably drifts out of sync. The _comment hack is already ugly and fragile — no guarantee it won't break if schema validation gets stricter — but as others have noted, it doesn't even work in arrays. Permission lists and hook arrays are exactly the places where you most need to document intent, and _comment keys simply can't go there.

JSONC is the established standard for exactly this use case. VS Code, tsconfig.json, devcontainer.json — the tooling ecosystem has already converged on it. Packages like strip-json-comments or jsonc-parser (the one VS Code itself uses) make this trivial to implement. The surface area is genuinely small:

  1. Strip comments before JSON.parse() (or use a JSONC parser)
  2. Check for settings.jsonc first, fall back to settings.json

No schema changes, no new features to document beyond "you can now use comments." This would be a huge quality-of-life win for everyone managing non-trivial configurations. Please prioritize this one — it's low effort, high reward, and long overdue.

mfoo · 1 month ago

We have a similar issue sharing enterprise managed settings files. Our current solution is to have a CI job that asserts that every setting in the managed settings file is documented in README.md. The ability to use inline comments would be extremely useful. Partly for the managed settings repo maintainers / auditors, but partly because a user whose action is blocked by the sandbox would be able to ask Claude why it's blocked and get a meaningful response as Claude can read the comments in the file.

ParadaCarleton · 1 month ago

+1 to TOML, +0.5 to JSON5. There's not really a reason to use old-school JSON instead of JSON5 nowadays given JSON5 is a superset and has fewer weird edge-cases.

RazorVedic · 1 month ago

+1

ShawnFumo · 25 days ago

I'd appreciate the ability to add comments as well. It might make the most sense to do JSONC first, since it'd be such a small change. Then could consider JSON5 or YAML or something else later as additional options.

ParadaCarleton · 23 days ago
Then could consider JSON5

JSON5 is a standardized/documented version of JSONC (which explicitly allows trailing commas and single-quoted strings, as in JS).

tredondo · 9 days ago

Come on Anthropic, what is so hard about switching the parser to JSONC? @coygeek

coygeek · 9 days ago

Ask Claude.