What is MIME type "text/json"?

A MIME type is a string that tells browsers and other tools how to handle a particular kind of file.

text/json is a MIME type that tells your computer the file contains plain text formatted as JSON.
It uses a simple, human-readable structure to store data. Programs that see this type know to treat the content as textual data with structured information.
Many files use this MIME type to store or exchange data. For example, a backup file for a Bitcoin wallet might use the TXT format; standard data files use JSON; web data captured from browsing sessions often use HAR; and various project files use formats like HPRJ or APJ. Other specialized file types such as C2D, VRX, MRT, PZI, and more also use this approach.
This MIME type makes it easy for both developers and end users to work with data. It’s central to many web applications and software tools that rely on the lightweight, text-based nature of JSON for configuration, reporting, and project data.
Learn more about how MIME types function on sites like IANA Media Types or about the JSON format on JSON.org.

Associated file extensions

Usage Examples

HTTP Header

When serving content with this MIME type, set the Content-Type header:


    Content-Type: text/json    
  

HTML

In HTML, you can specify the MIME type in various elements:


    <a href="file.dat" type="text/json">Download file</a>    
  

Server-side (Node.js)

Setting the Content-Type header in Node.js:


    const http = require('http');    
    
    http.createServer((req, res) => {    
      res.setHeader('Content-Type', 'text/json');    
      res.end('Content here');    
    }).listen(3000);    
  

Associated file extensions

FAQs

What is the difference between text/json and application/json?

application/json is the official IANA standard for JSON data (RFC 8259), whereas text/json is considered legacy and unofficial. However, developers sometimes use text/json to force web browsers to render the JSON data as visible text in the window, rather than triggering a file download.

Should I use text/json for my web API?

Generally, no; you should prefer application/json for modern web APIs to ensure strict compliance with standards and correct handling of UTF-8 encoding. text/json is mostly useful for debugging or for serving files intended to be read manually in a browser.

How do I configure Apache to serve .json files as text/json?

To force Apache to serve files with the .json extension as text, add AddType text/json .json to your .htaccess or server config file. This overrides the default application/json setting found in most modern configurations.

Why are .har files often associated with text/json?

A .har (HTTP Archive) file contains a record of web browser interaction formatted strictly as JSON. Using text/json allows users to easily open these logs in a browser or text editor to inspect network requests without needing specialized HAR viewer software.

Does text/json handle UTF-8 characters correctly?

It can, but because it is a text/* type, some older clients might default to ISO-8859-1 encoding if a charset is not explicitly provided. To ensure special characters display correctly, you should send the header Content-Type: text/json; charset=utf-8.

Why do specialized files like .bbmodel or .yyp use this MIME type?

Formats like .bbmodel (Blockbench) or .yyp (GameMaker) use JSON structures to store project data. Assigning them the text/json MIME type ensures that the operating system recognizes them as readable text, allowing for easy version control diffs and manual editing if the primary software is missing.

How do I fix 'Resource interpreted as Script but transferred with MIME type text/json' errors?

This error usually occurs when a browser tries to execute a JSON file as if it were JavaScript (common with JSONP). To fix it, ensure you are requesting data via fetch or XHR rather than a <script> tag, or change the server content type to application/javascript if you are indeed serving executable code.

General FAQ

What is a MIME type?

A MIME (Multipurpose Internet Mail Extensions) type is a standard that indicates the nature and format of a document, file, or assortment of bytes. MIME types are defined and standardized in IETF's RFC 6838.

MIME types are important because they help browsers and servers understand how to process a file. When a browser receives a file from a server, it uses the MIME type to determine how to display or handle the content, whether it's an image to display, a PDF to open in a viewer, or a video to play.

MIME types consist of a type and a subtype, separated by a slash (e.g., text/html, image/jpeg, application/pdf). Some MIME types also include optional parameters.

How do I find the MIME type for a file?

You can check the file extension or use a file identification tool such as file --mime-type on the command line. Many programming languages also provide libraries to detect MIME types.

Why are multiple MIME types listed for one extension?

Different applications and historical conventions may use alternative MIME identifiers for the same kind of file. Showing them all helps ensure compatibility across systems.