4 Matching Annotations
- Dec 2020
-
stackoverflow.com stackoverflow.com
-
var parsed = JSON.parse(myJSONData, function(k, v) { if (k === "name") this.key = v; else if (k === "children") this.value = v; else return v; });
Interesting. Didn't realize you could use reviver to change keys as well as values. What is
this
here? Since nothing is returned in the first 2 cases, I assume it removes the original key for those cases...
-
-
developer.mozilla.org developer.mozilla.org
-
JSON.parse() does not allow single quotes
-
JSON.parse() does not allow trailing commas
-
If a reviver is specified, the value computed by parsing is transformed before being returned.
-