DevPrep

All topics › Real interview tasks

Decoding awkward JSON: dates, keys, malformed items

Middle PRO

Task

The server returns:

{
  "user_name": "Ann",
  "created_at": "2026-03-01T10:15:00Z",
  "avatar_url": null,
  "orders": [
    { "id": 1, "total": 10.5 },
    { "id": "oops", "total": 3 },
    { "id": 3, "total": 7 }
  ]
}

Parse it into a model so that one malformed order doesn't fail the whole response.

The rest of this answer, with code and interview follow-ups, is in the DevPrep app.

Read the full answer in DevPrep

Practice this before your interview

DevPrep turns these answers into one-minute challenges: what does this code print, find the bug, mock interviews. One challenge a day.

Get DevPrep on the App Store