application/ld+json
API Design

Meaning

The IANA-registered MIME media type for JSON-LD (JSON for Linking Data), a JSON-based serialization for representing structured, machine-readable linked data on the web. It signals to parsers, crawlers, and APIs that the payload should be interpreted as a semantic graph rather than plain JSON. Developers reach for it whenever they need to embed or serve schema.org / RDF-backed metadata alongside regular JSON traffic.

Primary Function

Linked data format identification

Communicative Purpose

Enables semantic interoperability by declaring that a JSON payload follows the JSON-LD specification for linked data.

Pattern

declare Content-Type: application/ld+json OR <script type="application/ld+json"></script>

Função primária

Linked data format identification

Propósito comunicativo

Enables semantic interoperability by declaring that a JSON payload follows the JSON-LD specification for linked data.

Situações de gatilho

Web development: embedding schema.org structured data in HTML pages for SEO rich results; API design: serving linked-data responses from knowledge graphs or RDF-backed services; SEO: declaring JSON-LD blocks to search engine crawlers

Contextos

Semantic web, SEO, schema.org, knowledge graphs, REST APIs serving RDF data, headless CMS platforms

Padrão

declare Content-Type: application/ld+json OR <script type="application/ld+json"></script>

Colocados típicos

  • JSON-LD @context
  • schema.org types
  • Content-Type header
  • <script type="...">
  • structured-data validators (Google Rich Results Test
  • Schema Markup Validator)

Substituições comuns

  • application/json — simpler but loses semantic-web meaning and crawler signals
  • microdata / RDFa — inline HTML attribute-based structured data instead of a JSON block
  • application/rdf+xml or text/turtle — older RDF serializations with different MIME types

Erros comuns

Using application/json instead — crawlers won't parse the payload as linked data and rich-result eligibility is lost; Forgetting the @context property — JSON-LD without a context is just nested JSON with no semantic mapping; Treating the <script> block as executable JavaScript — browsers do not run application/ld+json scripts, they only expose the data to parsers; Setting charset inconsistently (application/ld+json; charset=utf-8 vs application/ld+json) — some validators reject mismatched parameters

Similar / contraste

application/json — plain JSON without semantic-web semantics; application/n-quads — RDF serialization for named graphs; microdata — inline HTML attribute-based structured-data alternative

Interferências

Coming from generic web development: may assume any JSON Content-Type is interchangeable — application/ld+json specifically signals JSON-LD semantics that parsers and crawlers key on; Coming from RDF/XML background: may expect application/rdf+xml — JSON-LD uses its own dedicated MIME type, not the older RDF one

Nuance

When NOT to use: skip it for plain JSON APIs that don't model linked data, since the extra semantic expectations add no value and can confuse strict parsers. Performance: parsing cost is comparable to JSON plus context resolution; large remote @context documents can bloat payloads and add a network round-trip. Boundary condition: the type is case-insensitive per RFC 2045 but lowercase is the canonical form; some validators reject variants like Application/LD+JSON.

Efeito pragmático

Correctly declaring this MIME type unlocks rich search results, knowledge panel features, and interoperability with semantic-web consumers such as Google's structured-data parsers, Wikidata importers, and any JSON-LD-aware client.

Dica de memória

application/ld+json is the passport stamp that tells the web 'this JSON speaks the language of linked data' — without it, your structured data is just anonymous JSON at the border.

Upgrade path

JSON-LD context design with nested @context, named graphs via @graph, and framing for complex knowledge-graph payloads

Frequência: MediumFormulaicidade: Fully fixedPrioridade de aquisição: Recognition firstPrioridade de output: InputTag de espaçamento: Medium-term

Log in to save chunks.