JSON Parse in JavaScript
Level 256 keystrokes
JSON.parse() converts a JSON string back into a JavaScript object.
JavaScript code
// Create a JSON string (note the single quotes around the string)1let str = '{"a":1,"b":2}';// JSON.parse() converts the JSON string to a JavaScript object// The result is a normal object, so JSON.parse(str).a is 1// Result: { a: 1, b: 2 }2console.log(JSON.parse(str));Output
{ a: 1, b: 2 }Practice typing this code. Results are not recorded in the rankings.
Symbols in this code
The symbols you type in this JavaScript code and how often they appear.
"× 4;× 2:× 2.× 2'× 2(× 2)× 2,× 1{× 1}× 1