Content-Type for JSON Patch (RFC 6902)

Set the Content-Type header for JSON Patch operations as defined in RFC 6902. Covers the application/json-patch+json media type.

JSON APIs

Detailed Explanation

JSON Patch Media Type

JSON Patch (RFC 6902) defines a format for describing changes to a JSON document. It uses a distinct media type so the server knows the body contains patch operations, not a complete replacement.

The Header Value

Content-Type: application/json-patch+json; charset=utf-8

JSON Patch Format

A JSON Patch document is an array of operation objects:

[
  { "op": "replace", "path": "/email", "value": "new@example.com" },
  { "op": "add", "path": "/phone", "value": "+1-555-0100" },
  { "op": "remove", "path": "/fax" }
]

Supported Operations

Operation Description
add Add a value at the specified path
remove Remove the value at the specified path
replace Replace the value at the specified path
move Move a value from one path to another
copy Copy a value from one path to another
test Test that a value at the specified path equals the given value

Related: JSON Merge Patch

For simpler partial updates, consider JSON Merge Patch (RFC 7396) which uses application/merge-patch+json. It lets you send only the fields you want to change without operation objects.

curl Example

curl -X PATCH \
  -H "Content-Type: application/json-patch+json" \
  -d '[{"op":"replace","path":"/name","value":"New Name"}]' \
  https://api.example.com/users/123

Use Case

Use this when making partial updates to REST API resources using JSON Patch. Common in APIs that follow the HTTP PATCH method correctly, such as ASP.NET Core, Spring Boot, and FastAPI endpoints.

Try It — Content-Type Header Builder

Open full tool