application/json
The standard MIME type for JavaScript Object Notation (JSON) data interchange.
What Is This?
The application/json MIME type indicates that the content being transmitted is JavaScript Object Notation (JSON) data. It is the most widely used content type for REST APIs, configuration files, and data interchange on the web. When a server sends application/json, the client knows to parse the response body as JSON rather than plain text or HTML.
Common Uses
Common Use
REST and GraphQL API request and response bodies
Common Use
Configuration files (package.json, tsconfig.json)
Common Use
Browser localStorage and sessionStorage data serialization
Common Use
WebSocket message payloads
Examples
Serve files with the application/json MIME type:
# Nginx
location ~ \.json$ {
add_header Content-Type "application/json";
}
# Apache
AddType application/json .jsonUse this MIME type in HTML or HTTP:
Content-Type: application/json <!-- HTML reference --> <link rel="preload" href="file.json" as="fetch" crossorigin>
Related Entries
More from this reference:
application/pdf
The MIME type for PDF (Portable Document Format) documents.
application/zip
The MIME type for ZIP archive files used for compression and bundling.
application/xml
The MIME type for XML documents and data interchange.
application/octet-stream
The generic MIME type for arbitrary binary data, often used for unknown file types or forced downloads.
application/x-www-form-urlencoded
The MIME type for URL-encoded form data submissions.
Frequently Asked Questions
Do I need to set application/json for every API response?
Yes. Always set Content-Type: application/json on JSON API responses. Without it, clients may not parse the response correctly and some browsers show a download prompt instead of processing the data.
What happens if I send application/json with invalid JSON?
The client will fail to parse the response and throw a JSON parse error. Always validate JSON before sending it with application/json content type.