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

Function parseJson

third_party/subscriptions-project/swg.js:4112–4114  ·  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

4110 * @return {?JsonObject|undefined} May be extend to parse arrays.
4111 */
4112function parseJson(json) {
4113 return /** @type {?JsonObject} */ (JSON.parse(/** @type {string} */ (json)));
4114}
4115
4116/**
4117 * Parses the given `json` string without throwing an exception if not valid.

Callers 4

tryParseJsonFunction · 0.70
fetchCredentialedJsonMethod · 0.70
sendPostMethod · 0.70

Calls 1

parseMethod · 0.45

Tested by

no test coverage detected