Implement transformResponse(raw)
Real APIs rarely hand you the shape your UI wants, snake_case, nested wrappers, numeric "flag" booleans. Write transformResponse(raw) that reshapes this specific ugly payload:
{
data: {
user_id: 42,
user_name: "ada_lovelace",
contact_info: { email_address: "ada@example.com" },
is_active_flag: 1
}
}into this UI-friendly shape:
{ id: 42, name: "ada_lovelace", email: "ada@example.com", active: true }