JSON Parse Result
Predict Output Easy
Question
What does this code print?
Code
let obj = JSON.parse('{"name": "Ada", "age": 30}');
console.log(obj.name);
Hint
JSON.parse converts a JSON string to an object.
Explanation
JSON.parse converts the JSON string into a JavaScript object. The string {"name": "Ada", "age": 30} becomes an object with properties name="Ada" and age=30. Accessing obj.name gives "Ada". Note that JSON keys must be double-quoted strings.
Related Resources
Related Lessons
- JSON
Learn JSON data format.
Look up unfamiliar terms
A beginner-friendly glossary explains jargon in plain English — variables, functions, DOM, Promise, and more.
Decode error messages
Plain-English explanations of common errors — what they mean, why they happen, and how to fix them.
Build real projects
Apply what you learned by building guided projects with starter code and solutions.