Challenge - 5 Problems
JSON Payload Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
💻 Command Output
intermediate1:30remaining
What is the output of this JSON payload after parsing?
Given this JSON payload received from an IoT sensor:
What will be the value of the
{"temperature": 22.5, "humidity": 48, "status": "ok"}What will be the value of the
status field after parsing?Attempts:
2 left
💡 Hint
Remember JSON strings are enclosed in double quotes and parsing keeps string values as strings.
✗ Incorrect
The status field is a string with value "ok". After parsing, it remains a string with quotes in code representation.
❓ Configuration
intermediate1:30remaining
Which JSON payload is correctly formatted for sending sensor data?
You want to send temperature and humidity data from a sensor in JSON format. Which of these payloads is correctly formatted?
Attempts:
2 left
💡 Hint
JSON keys must be in double quotes and values can be numbers or strings.
✗ Incorrect
Option B uses double quotes for keys and numeric values correctly. Option B and D miss quotes on keys. Option B uses a string for temperature which is allowed but less ideal for numeric data.
❓ Troubleshoot
advanced2:00remaining
Why does this JSON payload cause a parsing error?
This JSON payload is sent from a device:
Why does it cause a parsing error?
{"temp": 22.5, "humidity": 55, "status": ok}Why does it cause a parsing error?
Attempts:
2 left
💡 Hint
In JSON, string values must be enclosed in double quotes.
✗ Incorrect
The value ok is a string but is not enclosed in double quotes, causing a JSON parsing error.
🔀 Workflow
advanced2:30remaining
What is the correct order to process an incoming JSON payload from an IoT device?
Arrange these steps in the correct order to handle a JSON payload from an IoT sensor:
1. Validate JSON format
2. Parse JSON into data structure
3. Send acknowledgment to device
4. Extract sensor values
1. Validate JSON format
2. Parse JSON into data structure
3. Send acknowledgment to device
4. Extract sensor values
Attempts:
2 left
💡 Hint
You must check format before parsing, then extract data, then respond.
✗ Incorrect
First validate the JSON format to avoid errors, then parse it, extract needed values, and finally send acknowledgment.
✅ Best Practice
expert3:00remaining
Which JSON payload design is best for extensibility in IoT sensor data?
You want to design a JSON payload for sensor data that may add new fields later. Which design is best?
Attempts:
2 left
💡 Hint
Grouping sensor data inside a nested object helps add new fields without changing the main structure.
✗ Incorrect
Option A groups sensor readings inside a 'data' object, making it easier to add new sensor fields later without changing the top-level keys.