Read the weather API (Weather App)
Weather apps call an API that answers in JSON. Each input line is one answer: {"city", "tempc", "condition", "humidity", "windkph"}. Print <city: <temp°C, <condition, humidity <h%, wind <w km/h, rounding temperature and wind to whole numbers (halves away from zero: 18.5 → 19, −2.5 → −3). Bad JSON, a missing field or a field of the wrong type prints error: bad data.
Input: One JSON object per line.
Output: One line per object.
Difficulty: Easy. Write your answer in the browser editor, run the examples, then submit it against hidden tests. Python and JavaScript are free; other languages are part of licode Club.
Hint
- Use your language’s JSON parser, then check each field’s type.