# kotlinx.serialization.MissingFieldException: Field 'id' is required for type with serial name 'com.example.User', but it was missing

**Code:** `MissingFieldException: Field 'x' is required` · **Category:** Android · **Seen on:** Android, Kotlin

A required property wasn't present in the JSON being decoded.

## Meaning

kotlinx.serialization requires every non-default property. Give it a default, mark it nullable, or use `ignoreUnknownKeys`/`coerceInputValues` as needed.

## Common causes

- Field missing in JSON
- Server renamed the field
- No default for optional field

## Quick fix

1. Add `= null` or a default value
2. Use @SerialName for renamed fields
3. Configure Json { ignoreUnknownKeys = true }

## Detailed fix by platform

### Kotlin

1. `val json = Json { ignoreUnknownKeys = true; coerceInputValues = true }`

## How to diagnose

1. **Field** — present?
2. **Name** — @SerialName?
3. **Default** — provided?

---
Source: [WhatIsMyError](https://whatismyerror.com/errors/android/kotlinx-serialization-missing-field)
