JSON-LD vs microdata for AI: format comparison

In the JSON-LD vs microdata comparison, JSON-LD is the more defensible default. It lives in a single script block, keeps structured facts separate from presentation markup, and is the format Google's documentation names as recommended. Microdata and RDFa are equally valid schema.org, but they braid data into HTML attributes that are harder to extract in isolation and easier to break during redesigns.
JSON-LD vs microdata: the short answer
- JSON-LD is the default choice. It expresses schema.org data as a self-contained JSON object in a
<script>block, so the structured facts survive template changes and are trivial for a parser to lift out cleanly. - Microdata and RDFa are inline attribute formats. They annotate visible HTML with
itemprop,itemscope,property, andtypeofattributes — valid schema.org, but coupled to your DOM and far more brittle. - All three feed the same schema.org vocabulary. The format is the delivery mechanism; the meaning comes from the vocabulary. Answer engines do not publish how they parse markup, but a detached JSON-LD graph is the easiest of the three to extract in isolation — which is the practical argument for it.
The three structured data formats, briefly
schema.org — the shared vocabulary behind rich results and much of the structured web — can be serialized in three ways, and it is worth being precise about what each one is before comparing them.
Before scoring the JSON-LD vs microdata trade-offs, here is what each format is.
- JSON-LD (JavaScript Object Notation for Linked Data) is a W3C standard that embeds a JSON object, usually inside a
<script type="application/ld+json">tag in the page head or body. The data sits apart from the human-visible HTML entirely. - Microdata is an HTML living-standard mechanism that decorates existing elements with
itemscope,itemtype, anditempropattributes. The data and the display markup are the same elements. - RDFa (Resource Description Framework in Attributes) is a W3C recommendation that, like microdata, annotates HTML inline — using
vocab,typeof, andpropertyattributes. It is more expressive than microdata and correspondingly more verbose.
When people frame the JSON-LD vs microdata debate, RDFa is the quiet third option that behaves like microdata for our purposes: inline, DOM-coupled, and supported but not preferred. The rest of this piece treats microdata and RDFa together as the "inline" camp against the "detached" JSON-LD camp.
Why detached JSON-LD is easier to parse
An important caveat up front: Google AI Overviews, Gemini, ChatGPT, Perplexity, and Claude do not publicly document how — or whether — they consume structured data when composing answers, so any claim that they "prefer" one format is reasoning from parser design, not from first-party confirmation. What follows is that reasoning, framed as such, alongside the one thing that is documented: Google Search's own recommendation of JSON-LD.
A JSON-LD block is a complete, valid data document on its own. A parser can find the <script type="application/ld+json"> node, JSON.parse its contents, and immediately have a typed graph of entities — no walking the DOM tree, no reconciling nested itemscope boundaries, no guessing which text node a stray itemprop was meant to label. That determinism is a plausible reason a machine consumer would find JSON-LD easier to extract, though the engines behind AI answers do not confirm it.
Inline formats put the same information inside the rendered HTML, which sounds efficient but creates two problems for machines. First, the parser has to reconstruct the entity graph from attribute nesting, and a single misplaced closing tag or a component that re-orders the DOM can silently detach a property from its item. Second, the structured meaning is entangled with layout: a designer who refactors a card component can break your Product markup without touching a line of "data," because in microdata there is no separate line of data to protect.
There is a subtler, and admittedly unverified, argument too. If an engine cross-checks structured claims against prose when composing an answer — something none of them document — a discrete JSON-LD graph is easier to line up against the visible text than scattered inline attributes would be. Treat that as reasoning, not fact. Either way, the structured data is only half the picture; the prose still has to stand on its own, which is why the same discipline behind writing content that answer engines can use applies to your markup strategy as much as your copy.
The scorecard
Ratings are qualitative — strong, partial, or none — because inventing precise percentages for opaque, undocumented engine behavior would be dishonest. They reflect documented support (Google's), format standards, and the parser-design reasoning described above as of mid-2026. The AI-specific rows describe ease of extraction by any parser, not confirmed engine preferences.
| Criterion | JSON-LD | Microdata | RDFa |
|---|---|---|---|
| Google Search support | strong | strong | strong |
| Google's stated recommendation | strong | partial | partial |
| Parsing determinism for machines | strong | partial | partial |
| Decoupled from presentation HTML | strong | none | none |
| Resistance to redesign breakage | strong | partial | partial |
| Ease of adding a new schema type | strong | partial | partial |
| Expressiveness / linked-data depth | strong | partial | strong |
| Verbosity cost | strong | partial | none |
| Ecosystem tooling and validators | strong | partial | partial |
Two nuances the table compresses. RDFa scores "strong" on expressiveness because it can reference external vocabularies and relationships that microdata handles awkwardly — but that power comes with verbosity and, in practice, most sites only need the common schema.org types rather than exotic linked-data graphs. And "Google Search support" is uniformly strong: per Google's documentation all three formats are officially supported, so choosing microdata is not "wrong," it is just the harder road to maintain with little practical upside for most sites.
Common misconceptions
"Inline markup is better because the data is 'in' the content." This is intuitive but not how machine consumers work. There is no public evidence that search or AI crawlers reward proximity of data to visible text; what a parser can reliably do is extract typed facts. A detached JSON-LD block is not "hidden" from crawlers — Google documents that it reads JSON-LD, and it is meaningfully less breakable than inline attributes.
"JSON-LD is invisible, so engines might treat it as cloaking or spam." Google has stated for years that JSON-LD is the recommended format; it is the opposite of a penalty risk. The relevant rule is that your structured data must describe content actually present on the page. Cloaking is describing something the user cannot see — not the mere fact that the description lives in a script tag.
"Switching to JSON-LD means duplicating all my content." No. Well-built JSON-LD references the same facts your HTML already shows; it does not fork them into a second copy you maintain by hand. Generate it from the same source of truth that renders the page, and the two stay aligned automatically.
"Microdata is deprecated." Not true — microdata is part of the HTML living standard and remains valid and supported. The accurate statement is that JSON-LD is preferred, not that inline formats are dead. Existing microdata does not need an emergency rip-out; it needs a migration plan when you next touch the templates.
"llms.txt or a robots directive can substitute for schema." Different jobs. Access and curation files like your plain-text map for AI crawlers tell engines what to read and where the clean version lives; structured data tells them what the facts on a given page mean. You want both, and they do not overlap.
When inline formats still make sense
The JSON-LD vs microdata choice is not absolute — honesty over dogma, microdata or RDFa can be the pragmatic option in a few situations.
- You inherited a large microdata codebase that already validates. If it works and passes Google's Rich Results Test, ripping it out purely for format purity is busywork. Migrate opportunistically as you refactor components, not in one risky sweep.
- A platform or CMS emits inline markup you cannot easily override. Many themes ship microdata. If the platform maintains it correctly, leave it; adding a conflicting JSON-LD block for the same entity can create duplicate-entity confusion.
- You need RDFa's linked-data expressiveness for a specialized graph. Rare on marketing sites, but real in publishing, government, and library data. If that is genuinely your use case, you already know it.
Outside those cases, new structured data should be JSON-LD. The teams we see getting the most from schema work tend to standardize on one format and generate it centrally — a pattern that shows up across the use cases teams build citation programs around.
A migration checklist (microdata to JSON-LD)
If you decide to move, do it methodically rather than in a single high-risk rewrite.
- Inventory your current markup. Crawl your own site and list every page type carrying microdata or RDFa and which schema.org types each uses (
Product,Article,FAQPage,Organization,BreadcrumbList, and so on). - Map each type to a JSON-LD template. For every page type, draft the equivalent JSON-LD object with the same properties. Keep the
@typeand property names identical — only the serialization changes. - Generate from the source of truth. Bind each JSON-LD template to the data that already renders the page (your CMS fields, product database, or content manifest) so the markup cannot drift from the visible content.
- Validate before and after. Run each page type through the Schema Markup Validator and Google's Rich Results Test. Confirm the JSON-LD produces the same entities and eligibility the microdata did — no regressions.
- Remove the inline attributes. Once JSON-LD is live and validating, strip the
itemprop/itemscope(or RDFa) attributes from the templates so a single entity is not described twice in two formats. - Deploy per template, not all at once. Ship one page type, confirm it validates in production and that structured-data reports stay healthy, then move to the next.
- Watch the outcome, not just the markup. Validation confirms the format is correct; it does not tell you anything about how engines respond. Track share of citation before and after so you have evidence either way, rather than assuming a format change had an effect — the whole point of pairing markup work with a tracker.
What to check on any page before you ship
- The JSON-LD
@typematches what the page actually is. - Every property in the JSON-LD corresponds to content visible on the page.
- There is exactly one canonical description per entity — not competing JSON-LD and microdata for the same thing.
- The block parses as valid JSON (a trailing comma will silently break the whole graph).
- The page passes both the Schema Markup Validator and the Rich Results Test.
Getting this right is table stakes; knowing whether it moved your visibility is the harder question, and it is where the difference between validators and outcome trackers matters. Our own methodology for that — how we source claims and measure engine behavior — is documented on the editorial standards and methodology page, and if you are evaluating measurement options, it is worth comparing the AI search trackers on how they attribute citations rather than assuming they all count the same way.
JSON-LD vs microdata: the practical verdict
Choose JSON-LD unless a specific constraint forces otherwise. It is the format Google's documentation recommends, the format that decouples your facts from your layout, and — by parser design, not by any engine's confirmation — the format a machine can extract from a page with the least ambiguity. Microdata and RDFa remain valid and supported; the debate is not about right versus wrong, but about which serialization is the cleanest and most durable to maintain. On that basis, JSON-LD is the sensible default for most sites, with the honest caveat that no answer engine documents whether the format choice changes how it treats your content.
References
- Google Search Central, Introduction to structured data markup in Google Search. https://developers.google.com/search/docs/appearance/structured-data/intro-structured-data
- W3C, JSON-LD 1.1 — A JSON-based Serialization for Linked Data (W3C Recommendation, 2020). https://www.w3.org/TR/json-ld11/
- W3C, RDFa Core 1.1 — Third Edition (W3C Recommendation). https://www.w3.org/TR/rdfa-core/
- WHATWG, HTML Living Standard — Microdata. https://html.spec.whatwg.org/multipage/microdata.html
- Schema.org, Getting started with schema.org using Microdata, RDFa, and JSON-LD. https://schema.org/docs/gs.html
Next steps
- Read the structured-data-for-AI pillar to understand what structured data is and what is known about how answer engines handle it before you pick a format.
- Compare how AI search trackers attribute citations so you can measure whether a migration to JSON-LD changes anything, rather than assuming it will.
- When you are ready, create a Prime AI Visibility workspace and bring 10 buyer prompts to see how the engines treat your pages today.
Frequently asked questions
Is JSON-LD better than microdata for AI answer engines?
No answer engine documents a format preference, so nobody can state this as fact. What is defensible: JSON-LD is a self-contained, typed data graph that any parser can extract in isolation, while microdata forces a parser to reconstruct the same graph from inline HTML attributes that break easily. On parser design, JSON-LD is the less ambiguous read; on confirmed engine behavior, there is no public evidence either way.
Does Google still support microdata and RDFa?
Yes. Google officially supports JSON-LD, microdata, and RDFa for structured data. It recommends JSON-LD as the preferred format, but microdata and RDFa are not deprecated and will not cause a penalty. The recommendation is about reliability and maintainability, not eligibility.
Will switching from microdata to JSON-LD affect my search performance?
There is no documented reason it should, provided the JSON-LD describes the same content and validates cleanly — Google supports all three formats. Migrate per page type, validate before and after with the Rich Results Test, and remove the old inline attributes only once JSON-LD is confirmed live. The realistic risk is a botched migration, not the format itself.
Is JSON-LD considered hidden content or cloaking?
No. Google explicitly recommends JSON-LD, so a script-based description is expected, not penalized. The only rule that matters is that your structured data must reflect content genuinely present on the page — describing things a user cannot see is what triggers structured-data policy problems, regardless of format.
Do I need structured data at all if I already publish an llms.txt file?
They do different jobs. A curation file like llms.txt tells crawlers which pages are worth reading and where the clean version lives; structured data tells an engine what the facts on a given page mean. Use both — they complement rather than replace each other.
How do I know if my structured data changes had any effect?
Validation confirms the markup is correct; it says nothing about how engines respond, and engines do not document that. Track your share of citation across the answer engines before and after the change, so you have evidence rather than a guess about whether the markup work made a difference.
Shipped clean JSON-LD? Now measure it.
Markup is an input; citation is an outcome you should verify, not assume. Create a workspace, add ten buyer prompts, and see what the engines are actually doing.
Start tracking free
