Bird
0
0

Which of the following is the correct way to represent a simple dictionary in JSON format?

easy📝 Syntax Q3 of 15
Python - Structured Data Files
Which of the following is the correct way to represent a simple dictionary in JSON format?
A{"name": "Alice", "age": 30}
B{name: Alice, age: 30}
C["name" => "Alice", "age" => 30]
D(name: "Alice", age: 30)
Step-by-Step Solution
Solution:
  1. Step 1: Recall JSON syntax rules

    JSON requires keys and string values in double quotes, with colon separating key and value, and commas between pairs.
  2. Step 2: Match the correct JSON format

    {"name": "Alice", "age": 30} uses double quotes correctly and proper syntax for a JSON object.
  3. Final Answer:

    {"name": "Alice", "age": 30} -> Option A
  4. Quick Check:

    Correct JSON syntax = {"name": "Alice", "age": 30} [OK]
Quick Trick: JSON keys and strings need double quotes [OK]
Common Mistakes:
  • Omitting quotes around keys or strings
  • Using square brackets for objects
  • Using parentheses instead of braces

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Python Quizzes