Project

General

Profile

Actions

Bug #22241

open

Restore compatibility for removed `JSON.dump` and `JSON.parse` arguments

Bug #22241: Restore compatibility for removed `JSON.dump` and `JSON.parse` arguments

Added by nobu (Nobuyoshi Nakada) 3 days ago. Updated 2 days ago.

Status:
Open
Target version:
ruby -v:
f51515f39a13223ce784eb3412c1f83a8a3960a4
[ruby-core:126369]

Description

JSON 3.0.0.rc1 removes two previously accepted arguments without a deprecation period:

JSON.dump(object, io, 0)
JSON.parse(source, quirks_mode: true)

The first call now raises TypeError because the third positional argument is treated as an options hash. The second raises ArgumentError because quirks_mode is no longer recognized.
Neither usage produces a deprecation warning with JSON 2.21.2, even with warnings enabled:

Warning[:deprecated] = true

This currently breaks downstream test suites. RDoc used the third JSON.dump argument when generating its JSON index, while json-schema 5.1.0 passes quirks_mode: true, causing RBS schema tests in the Ruby repository to fail.
Because JSON is a default gem, downstream projects cannot always avoid the breakage by pinning an older version, especially when testing against Ruby head. Could JSON 3.0 continue accepting these arguments for compatibility? quirks_mode can presumably be accepted and ignored now that top-level scalar values are parsed by default. The positional limit argument could similarly remain supported until it has gone through a deprecation cycle.

Actions

Also available in: PDF Atom