0
0
IOT Protocolsdevops~20 mins

JSON payload formatting in IOT Protocols - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
JSON Payload Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
💻 Command Output
intermediate
1:30remaining
What is the output of this JSON payload after parsing?
Given this JSON payload received from an IoT sensor:
{"temperature": 22.5, "humidity": 48, "status": "ok"}

What will be the value of the status field after parsing?
Anull
B"ok"
Cok
D"OK"
Attempts:
2 left
💡 Hint
Remember JSON strings are enclosed in double quotes and parsing keeps string values as strings.
Configuration
intermediate
1: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?
A{temperature: 25, humidity: 60}
B{"temperature": 25, "humidity": 60}
C{"temperature": "25", "humidity": 60}
D{"temperature": 25, humidity: 60}
Attempts:
2 left
💡 Hint
JSON keys must be in double quotes and values can be numbers or strings.
Troubleshoot
advanced
2:00remaining
Why does this JSON payload cause a parsing error?
This JSON payload is sent from a device:
{"temp": 22.5, "humidity": 55, "status": ok}

Why does it cause a parsing error?
AThe commas between fields are missing.
BThe temperature value 22.5 must be an integer.
CThe keys temp and humidity must be numbers, not strings.
DThe value ok is not in double quotes, so it's invalid JSON.
Attempts:
2 left
💡 Hint
In JSON, string values must be enclosed in double quotes.
🔀 Workflow
advanced
2: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
A1,2,4,3
B2,1,4,3
C1,4,2,3
D4,1,2,3
Attempts:
2 left
💡 Hint
You must check format before parsing, then extract data, then respond.
Best Practice
expert
3: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?
A{"sensor_id": "123", "data": {"temp": 22.5, "humidity": 55}}
B{"sensor_id": "123", "temp": 22.5, "humidity": 55}
C[{"sensor_id": "123"}, {"temp": 22.5}, {"humidity": 55}]
D{"123": {"temp": 22.5, "humidity": 55}}
Attempts:
2 left
💡 Hint
Grouping sensor data inside a nested object helps add new fields without changing the main structure.