Inactive
Classification: API Change
Human Validated: KW
Title: JSON.tryParse
Authors: Jack Works
Rejected; some deemed this too specific a solution for a generalized language-wide problem
Last Presented: None
Stage Upgrades:
Stage 1: NA
Stage 2: NA
Stage 2.7: NA
Stage 3: NA
Stage 4: NA
Last Commit: 2024-04-23
Topics: objects others
Keywords: json parsing error_handling
GitHub Link: https://github.com/Jack-Works/proposal-json-tryParse
GitHub Note Link: https://github.com/tc39/notes/blob/main/meetings/2023-11/november-29.md#jsontryparse
Proposal Description:
JSON.tryParse
Rejected by tc39 on Nov 2023.
Problem to solve
try { return JSON.parse(str) } catch { return undefined }
Prior art
Spec
JSON.parse ( _text_ [ , _reviver_ ] )
1. Let _result_ be Completion(Call(%JSON.parse%, *null*, << _text_, _reviver_ >> )).
2. If _result_ is an abrupt completion, return *undefined*.
3. Return _result_.