MCPcopy Create free account
hub / github.com/ampproject/amphtml / parseJson

Function parseJson

third_party/subscriptions-project/config.js:427–429  ·  view source on GitHub ↗

* Simple wrapper around JSON.parse that casts the return value * to JsonObject. * Create a new wrapper if an array return value is desired. * @param {*} json JSON string to parse * @return {?JsonObject|undefined} May be extend to parse arrays.

(json)

Source from the content-addressed store, hash-verified

425 * @return {?JsonObject|undefined} May be extend to parse arrays.
426 */
427function parseJson(json) {
428 return /** @type {?JsonObject} */ (JSON.parse(/** @type {string} */ (json)));
429}
430
431/**
432 * Parses the given `json` string without throwing an exception if not valid.

Callers 1

tryParseJsonFunction · 0.70

Calls 1

parseMethod · 0.45

Tested by

no test coverage detected