The key "battery" has the value 85 without quotes, meaning it is a number.
Step 2: Understand JSON value types
Numbers in JSON are written without quotes, so the value is the number 85, not a string.
Final Answer:
85 -> Option A
Quick Check:
Number values have no quotes in JSON [OK]
Hint: Numbers in JSON have no quotes, strings do [OK]
Common Mistakes:
Confusing numbers with strings by adding quotes
Selecting the key name instead of its value
Assuming missing keys return null
4. Identify the error in this JSON payload:
{"temp": 25, "humidity": 55,}
medium
A. Missing quotes around keys
B. Keys and values swapped
C. Using single quotes instead of double quotes
D. Trailing comma after last item
Solution
Step 1: Check JSON syntax for commas
JSON does not allow a comma after the last key-value pair, so the comma after 55 is invalid.
Step 2: Verify other syntax elements
Keys have double quotes, and values are correct. No other syntax errors present.
Final Answer:
Trailing comma after last item -> Option D
Quick Check:
No trailing commas allowed in JSON [OK]
Hint: No comma after last item in JSON objects [OK]
Common Mistakes:
Leaving trailing commas after last pair
Forgetting quotes around keys
Mixing single and double quotes
5. You want to send a JSON payload from an IoT device reporting temperature and status. Which of these payloads correctly formats a nested JSON object for location with latitude and longitude?