Bird
0
0

Which of the following is the correct JSON structure to represent a payment request with amount and currency?

easy🧠 Conceptual Q3 of 15
LLD - Design — Parking Lot System
Which of the following is the correct JSON structure to represent a payment request with amount and currency?
A{ amount = 100, currency = 'USD' }
B{ 'amount': 100, 'currency': 'USD' }
C{ amount: 100, currency: USD }
D{ \"amount\": 100, \"currency\": \"USD\" }
Step-by-Step Solution
Solution:
  1. Step 1: Recall JSON syntax rules

    JSON keys and string values must be double-quoted. Numbers do not need quotes.
  2. Step 2: Check each option

    { \"amount\": 100, \"currency\": \"USD\" } uses double quotes correctly. { 'amount': 100, 'currency': 'USD' } uses single quotes (invalid JSON). { amount: 100, currency: USD } lacks quotes around keys and string value. { amount = 100, currency = 'USD' } uses equals sign instead of colon.
  3. Final Answer:

    { "amount": 100, "currency": "USD" } -> Option D
  4. Quick Check:

    Valid JSON = Double quotes for keys and strings [OK]
Quick Trick: JSON keys and strings need double quotes [OK]
Common Mistakes:
MISTAKES
  • Using single quotes instead of double quotes
  • Omitting quotes around string values
  • Using equals sign instead of colon

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More LLD Quizzes