API Design · Middle · Question 64 of 75
Why should API responses avoid exposing nulls for fields that are 'not applicable' vs 'unknown' without documentation?
- ✓Correct answer: Clients can't tell missing, empty and null apart unless the contract defines what each means
- 2JSON doesn't allow null
- 3Null fields break HTTP
Explanation
Decide whether absent and null differ, and document it, especially for PATCH semantics.