API Design · Middle · Question 3 of 75

How should a JSON Merge Patch request treat null?

PATCH /users/42
Content-Type: application/merge-patch+json

{ "nickname": null, "city": "Kyiv" }

Explanation

Merge Patch (RFC 7396) can't set a value to literal null or edit array elements; JSON Patch (RFC 6902) can, with explicit operations.

Further reading

Problem with a question

API Design · Middle · question 3

Test yourself

Take the API Design · Middle quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz