// mime type · application type

application/json

JSON data · .json

What application/json is

application/json is the standard type for JSON — the default for most REST APIs. Setting it on a request body tells the server to parse JSON; a mismatched type is a common cause of 400 and 415 errors.

How it's used

You'll see this as a Content-Type value on requests and responses — for example Content-Type: application/json. It's the type associated with the .json file extension. Application types cover structured data and binary formats — from JSON and XML to PDFs, archives, and Office documents.

Example

HTTP/1.1 200 OK
Content-Type: application/json

{"id": 42, "name": "Ada"}

Set application/json on your server

fetch request body

fetch("/api/items", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({ name: "Ada" }),
});

curl

curl -X POST https://api.example.com/items \
  -H "Content-Type: application/json" \
  -d '{"name":"Ada"}'

Node / Express response

res.json({ id: 42 }); // sets Content-Type: application/json

Common problems with application/json

Do I need charset=utf-8 with application/json?

No. JSON is defined as UTF-8, and the application/json type has no charset parameter. Adding one is harmless but redundant.

Why does my server return 415 or parse an empty body?

Most JSON body parsers only run when the request has Content-Type: application/json. Without it (or with text/plain) the body is ignored or rejected.

Why does my JSON request trigger a CORS preflight?

In cross-origin requests, application/json is not one of the "simple" content types, so the browser sends an OPTIONS preflight first. The server must answer it with the right Access-Control-Allow-* headers.

What about text/json or application/x-json?

Those are non-standard. Use application/json.

Related types

Other application types