JSON.tryParse ?
Proposal details
- Stage: Unstaged
- Status: Inactive
- ECMAScript edition: —
- Synchronized: Aug 28, 2026
- 中文译文 · Source repository
Proposal overview
This proposal introduces a JSON.tryParse method that returns undefined on parse failure instead of throwing an exception, simplifying the pattern of try-catch around JSON.parse. It was presented to TC39 but rejected in November 2023. The proposal includes spec pseudo-code showing a call to the existing JSON.parse with optional reviver, and cites URL.canParse as prior art for handling parse failures gracefully.
Note
The README below comes from the upstream repository and may contain outdated stage or status metadata. Use the proposal details above as the current source of truth.
JSON.tryParse
Rejected by tc39 on Nov 2023.