Deprecate default support of JavaScript comments in the parser#1001
Merged
Conversation
Add the `allow_comments: true` parsing option.
4 tasks
yahonda
added a commit
to rails/rails
that referenced
this pull request
Jun 24, 2026
json 2.20.0 (ruby/json#1001, commit 138b9a2c) deprecates the parser's default support for JavaScript comments in favor of an `allow_comments: true` option. Parsing comment-bearing JSON without it now warns that it "will raise an error in json 3.0 unless enabled via `allow_comments: true`", which fails Active Support and Railties under the test suite's warnings-as-errors mode. Pass `allow_comments: true` at the parse sites that intentionally read comment-bearing JSON: - Active Support's JSON message serializer fallback `_load`, which is documented to load irregular JSON (the test feeds it a leading `/* comment */`). - Railties' devcontainer.json, which is JSONC by spec: the `db:system:change` generator that re-reads it, and the generator test helper that asserts on the generated file. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add the
allow_comments: trueparsing option.TODO: