DevToolsmith

JSONLD MIME Type

application/ld+json is the MIME type for JSON-LD linked data. Here is the Content-Type header to send, the file signature, and how to configure servers and code.

MIME type
application/ld+json
Extensions
.jsonld
Content-Type header
application/ld+json
Registered
Yes, with IANA
Compress with gzip
Yes, it is text or uncompressed
Category
Data and text

About JSON-LD files

Best known from structured data for search engines: <script type="application/ld+json"> blocks in a page describe it as an Article, Product or FAQ with schema.org vocabulary. The browser doesn’t run these scripts; search engines read them.

File signature

JSONLD has no fixed signature: it is data without a magic number, so validate uploads by parsing the content rather than by checking bytes.

Serve .jsonld with the right Content-Type

Response header
Content-Type: application/ld+json
nginx (a line in the types { } block of mime.types)
application/ld+json jsonld;
Apache (.htaccess or server config)
AddType application/ld+json .jsonld
Caddy
@jsonld path *.jsonld
header @jsonld Content-Type "application/ld+json"
Check what a server sends
curl -sI https://example.com/file.jsonld | grep -i '^content-type'
# Content-Type: application/ld+json

Set the type in code

Node.js (Express)
res.set('Content-Type', 'application/ld+json');
// Or make the browser download it:
res.attachment('file.jsonld');
Python
import mimetypes

mimetypes.add_type('application/ld+json', '.jsonld')  # if your system doesn't know it
mimetypes.guess_type('file.jsonld')[0]  # 'application/ld+json'
Go
mime.AddExtensionType(".jsonld", "application/ld+json")
w.Header().Set("Content-Type", "application/ld+json")

Accept .jsonld uploads

HTML
<input type="file" accept=".jsonld,application/ld+json">

The accept attribute only filters the file picker; users can still choose another file. Listing the extension as well as the type matters, because operating systems don’t always report the type you expect.

Related types

  • .json (application/json): JSON
  • .html (text/html): HTML
  • .xml (application/xml): XML

More data and text

.txt , .csv , .tsv , .md , .ndjson , .yaml , .geojson , .ics , .sql . Look up any extension or type with the MIME type lookup.

Sources

Spotted a mistake? Email hello@devtoolsmith.com and we’ll fix it.

Frequently asked questions

What is the MIME type for .jsonld files?

application/ld+json. The full header is "Content-Type: application/ld+json".

Why does my server send the wrong Content-Type for .jsonld?

Web servers pick the type from the file extension using a table (mime.types in nginx and Apache). If .jsonld is missing from that table, they send a default such as application/octet-stream or text/plain. Add the mapping as shown on this page, then check the response with "curl -sI".

How can I check that a file really is JSONLD?

JSONLD has no fixed file signature, so the extension and content are all you have. Check that the content is what you expect, for example by parsing it, before trusting an upload.