Decoding awkward JSON: dates, keys, malformed items
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