Parse text that must be a JSON object, or throw a typed error.
Four parsers used to call JSON.parse bare and then index the
result, so malformed text escaped as a raw SyntaxError and the
literal text "null" (valid JSON) escaped as a TypeError from
reading version off null. Both were failures of the declared
contract, not of the caller. Doing it once here means neither can
come back one parser at a time.
Parse text that must be a JSON object, or throw a typed error.
Four parsers used to call
JSON.parsebare and then index the result, so malformed text escaped as a rawSyntaxErrorand the literal text"null"(valid JSON) escaped as aTypeErrorfrom readingversionoffnull. Both were failures of the declared contract, not of the caller. Doing it once here means neither can come back one parser at a time.