Skip to content

application/ld+json MIME Type — Meaning, Usage & Examples

application/ld+json
Extensions: .jsonld Class: application Spec: W3C (IANA registered)
View IANA registration ↗

application/ld+json means: application/ld+json is the media type for JSON-LD, a method of encoding Linked Data using JSON. It expresses structured, semantically typed entities and relationships, and is the format search engines recommend for embedding schema.org structured data in web pages. Application media types carry structured or binary data that a program consumes rather than a human reading raw bytes. The subtype tells the receiver exactly which parser, decoder or handler to invoke, so sending the correct Content-Type is part of the API contract: a mismatch makes servers reject the body with 415 Unsupported Media Type or clients mis-parse the payload. You will encounter application/ld+json in contexts such as schema.org structured data embedded in html script tags; semantic web and knowledge-graph data interchange; seo rich-result markup for articles, products, faqs and breadcrumbs. It is commonly associated with the file extension(s) .jsonld. When embedded in a page, JSON-LD goes in a script type=application/ld+json block, not as the page Content-Type. The document itself stays text/html; the ld+json type applies to the data island or to a standalone JSON-LD API response.

Advertisement
Ad slot · ref-top

When you'll see application/ld+json

  • schema.org structured data embedded in HTML script tags
  • Semantic web and knowledge-graph data interchange
  • SEO rich-result markup for articles, products, FAQs and breadcrumbs

How to handle it

When handling an application type, set the Content-Type header explicitly on every request and response that carries a body, and advertise what you accept with the Accept header. Parse the payload with a library that matches the subtype rather than sniffing bytes, and validate the structure before trusting it. If a server returns 415, the declared type does not match what it expects — compare your header against the API documentation character for character, including parameters such as charset or boundary. As a final checklist for application types: register the exact subtype in your API documentation, validate incoming bodies against a schema before use, set X-Content-Type-Options: nosniff to stop MIME sniffing, and version your media types when the payload contract changes so old clients keep working.

Notes & gotchas

When embedded in a page, JSON-LD goes in a script type=application/ld+json block, not as the page Content-Type. The document itself stays text/html; the ld+json type applies to the data island or to a standalone JSON-LD API response.

Examples

HTTP
HTTP/1.1 200 OK
Content-Type: application/ld+json
Content-Length: 82

Sample application/ld+json content delivered with the correct Content-Type header.
curl
curl -i -H "Accept: application/ld+json" https://api.example.com/v1/resource   # inspect the returned Content-Type
JavaScript (fetch)
const res = await fetch("/v1/resource", { headers: { Accept: "application/ld+json" } });
if (!res.ok) throw new Error(`HTTP ${res.status}`);
const data = await res.json();   // parsed structured payload
Python (requests)
import requests

res = requests.get("https://api.example.com/v1/resource",
                   headers={"Accept": "application/ld+json"}, timeout=10)
res.raise_for_status()
data = res.json()   # parsed structured payload

Frequently asked questions

Does JSON-LD change my page's Content-Type?

No. The page remains text/html; JSON-LD is placed inside a script type=application/ld+json element. Use application/ld+json as the response type only when serving a standalone JSON-LD document.

Why use JSON-LD for SEO?

Search engines parse it to understand entities and eligibility for rich results. It is decoupled from visible markup, so you can add structured data without changing the rendered HTML.

What happens if I send the wrong application Content-Type?

Servers that validate media types answer 415 Unsupported Media Type, and clients may parse the body with the wrong decoder. Always set Content-Type to the registered type that matches your payload, and set Accept to the types you can handle.

Is application/octet-stream a safe default?

It means 'arbitrary binary bytes' and forces a download rather than inline handling. Use it only when the real type is unknown or you deliberately want a save-as dialog; otherwise declare the specific registered type.

How do I debug a 415 Unsupported Media Type response?

Compare the Content-Type you actually sent against what the endpoint documents, including parameters like charset and boundary. A 415 means the server refuses that media type; send the exact registered type it accepts and retry.

Advertisement
Ad slot · ref-in-article

Try the JSON Formatter

Beautify, validate and minify JSON with clear error messages.

Open tool →