S SCHEMA.BIZ

Last updated:

Microdata to JSON-LD Converter

A Microdata to JSON-LD converter for pasted HTML or a page's URL. It converts RDFa too, and JSON-LD back to Microdata.

How to use the converter

Paste a page's HTML, or a template's markup, in the Paste HTML tab, or switch to Check a URL and enter the page's address. The converter finds every Microdata item and every RDFa item and shows them as one JSON-LD block, ready to copy or download. Under the result it lists anything that didn't carry over, and it runs the Schema Validator's engine on both versions to check that the JSON-LD gives the same result.

To go the other way, choose JSON-LD to Microdata, then paste JSON-LD or HTML that contains JSON-LD script blocks. The result is a Microdata snippet to merge into your own markup. Load an example shows each direction with a small product or event.

What the converter does with your markup

It doesn't parse your HTML a second way. The Schema Validator already reads Microdata (itemscope, itemtype, itemprop, and itemref, with a guard against loops) and RDFa (vocab, typeof, property, the schema: prefix) into JSON-LD-shaped objects before it checks them. The converter writes those same objects out as JSON-LD:

  • The document starts with "@context": "https://schema.org". One top-level item becomes one object; several become an @graph array.
  • Nested items, such as a Product's offers or an Event's location, stay nested inline, the way the HTML nested them.
  • itemid (Microdata) and resource or about (RDFa) become @id.
  • A property that appears more than once becomes an array, in page order.
  • Values are kept as the markup gives them. Microdata reads content first, then the address of a link or image, then the datetime of a time element, then the visible text. So "price": "129.00" stays a string, and dates and ISO 8601 durations such as PT30M stay strings too. schema.org and Google both accept text values for numbers.
  • Empty values and empty items are left out and listed, so you can see what disappeared.

The JSON-LD comes inside a script element that escapes the less-than sign, so a value that happens to contain a closing script tag can't end the block early. JSON-LD blocks already on the page are counted, not converted; the result tells you they're there.

An example: a product in Microdata

This is a product with a nested brand, offer and rating, the kind of markup older e-commerce themes print. The gtin13 has no value:

<div itemscope itemtype="https://schema.org/Product">
  <h1 itemprop="name">Trail Runner 2</h1>
  <img itemprop="image" src="https://shoes.example/tr2.jpg" alt="Trail Runner 2">
  <meta itemprop="sku" content="TR2-42">
  <meta itemprop="gtin13" content="">
  <div itemprop="brand" itemscope itemtype="https://schema.org/Brand">
    <span itemprop="name">Example Shoes</span>
  </div>
  <div itemprop="offers" itemscope itemtype="https://schema.org/Offer">
    <span itemprop="priceCurrency" content="EUR">€</span><span itemprop="price" content="129.00">129,00</span>
    <link itemprop="availability" href="https://schema.org/InStock">In stock
  </div>
  <div itemprop="aggregateRating" itemscope itemtype="https://schema.org/AggregateRating">
    Rated <span itemprop="ratingValue">4.6</span>/5 from <span itemprop="reviewCount">212</span> reviews
  </div>
</div>

The converter writes it as one JSON-LD object, lists gtin13 as left out because its value is empty, and the engine finds the same thing in both versions: a Product eligible for product snippets and merchant listings, no errors, and the same two recommendations.

{
  "@context": "https://schema.org",
  "@type": "Product",
  "name": "Trail Runner 2",
  "image": "https://shoes.example/tr2.jpg",
  "sku": "TR2-42",
  "brand": {
    "@type": "Brand",
    "name": "Example Shoes"
  },
  "offers": {
    "@type": "Offer",
    "priceCurrency": "EUR",
    "price": "129.00",
    "availability": "https://schema.org/InStock"
  },
  "aggregateRating": {
    "@type": "AggregateRating",
    "ratingValue": "4.6",
    "reviewCount": "212"
  }
}

Migrating from Microdata to JSON-LD, step by step

  1. List the templates that print Microdata or RDFa. Run the Schema Audit on one page of each template (product, article, category, contact) to see every item and its format.
  2. Convert one page per template. Check its URL here, and read the "not carried over" list: an empty value usually means a template field that's blank on some pages.
  3. Make the JSON-LD dynamic. The converted block holds one page's values. Have the template print the same structure from the same fields, rather than pasting a fixed block into every page.
  4. Remove the old attributes in the same release. Keep one copy of each item, either the JSON-LD or the Microdata, not both.
  5. Check the result. Run the new page through the Schema Validator, then Google's Rich Results Test, and watch the rich result reports in Search Console for the following weeks.

What changes for Google, and what doesn't

What doesn't change. Google says all three formats are equally fine when the markup is valid and follows each feature's documentation. A Product that was eligible for product snippets in Microdata is eligible in JSON-LD with the same properties, and one missing a required property is still missing it. The content rules don't change either: Google's guidelines say not to mark up content readers can't see, and that structured data never guarantees a rich result.

What changes. Google recommends JSON-LD where your site's setup allows it, for practical reasons. It isn't interleaved with the visible text, which makes nested items easier to express. And Google can read JSON-LD that JavaScript or a CMS widget adds to the page. (This site's URL check doesn't run JavaScript, so it won't see a block a script adds.) For you, the main change is maintenance: a redesign can't break JSON-LD by moving a span.

Pitfalls

Duplicate items when both formats stay. If the JSON-LD goes live and the Microdata stays, each product, article or organization is described twice. The Audit flags an Organization, WebSite or Person described more than once without a shared @id; for other types, compare the two yourself. Remove the old attributes in the release that adds the JSON-LD.

itemref. Microdata can pull properties from elsewhere on the page with itemref and element ids. The converter follows it, so those properties land in the right item, but a template that moves or renames the referenced ids changed the Microdata without anyone noticing. The JSON-LD has no such links: check that the values it shows are the ones you expect.

Values that aren't the visible text. A Microdata content attribute wins over the text readers see, so a price shown as "129,00 €" may be 129.00 in the markup. The JSON-LD keeps the attribute's value. Make sure the template fills it from the same field as the visible text.

Other vocabularies. Old pages sometimes carry data-vocabulary.org breadcrumbs or Dublin Core properties. The converter keeps their types and properties as full addresses and says so; Google reads schema.org, so replace them with schema.org's types, such as BreadcrumbList.

Converting JSON-LD to Microdata

Some platforms only let you edit templates, not the head of the page, so Microdata is still the practical choice. The JSON-LD to Microdata direction writes each node as an element with itemscope and itemtype, and each property as an element with itemprop: text in a span, a date in a time element, an image in an img, another address in a link, and numbers, codes and durations in meta. A reference to another node by @id becomes a link, since Microdata can only point at another item through itemref. Treat it as a starting point: put each itemprop on the element that already shows that value, and keep meta and link for what readers don't see. The output is text to copy, never rendered on this page.

FAQ

Does Google prefer JSON-LD to Microdata?

Google recommends JSON-LD where your site's setup allows it, and says all three formats, JSON-LD, Microdata and RDFa, are equally fine for Google as long as the markup is valid and follows each feature's documentation. Converting doesn't make a page eligible for anything new: the same properties are needed in any format. The gain is maintenance: JSON-LD sits apart from your HTML, so a template change can't silently break it.

What does the converter leave out?

Empty values (an itemprop or property with no text, content, href or src) and empty items (an itemscope or typeof with no type and no properties). Each one is listed under the result. Formatting inside a value, such as bold text or line breaks, becomes plain text, and dates, durations and prices stay as the text the markup gives. Types and properties from vocabularies other than schema.org are kept as full addresses, and the result says which.

Can I convert RDFa to JSON-LD too?

Yes. The converter reads RDFa Lite the same way as the Schema Validator: typeof with the schema.org vocab on the element or an ancestor, or the schema: prefix, and property for each value. Open Graph meta tags, which use RDFa-like property attributes, aren't schema.org and are left alone. A page with both Microdata and RDFa gets one JSON-LD block with all of their items.

How do I convert JSON-LD to Microdata?

Choose JSON-LD → Microdata and paste the JSON-LD, or a page's HTML with JSON-LD blocks, or check a URL. You get a snippet with itemscope, itemtype and itemprop: text in span elements, dates in time, images in img, other addresses in link, and numbers, codes and durations in meta. It's a starting point: move each itemprop onto the element that already shows that value on your page, since Google asks that structured data describe content readers can see.

Is my HTML sent to a server?

Pasted HTML is converted in your browser and never uploaded. When you check a URL, our server fetches the page as SchemaBizBot and sends its HTML back to your browser, where it's converted. We record anonymous usage metadata about each conversion: the formats converted from and to, how many items, how many values were left out and whether the engine found the same result, never the HTML or the JSON-LD (see the privacy policy).

Related tools and guides

  • JSON-LD vs Microdata vs RDFa: how the three formats compare, with the same item in each.
  • Schema Validator: check the converted JSON-LD against schema.org and Google's requirements. It offers Convert to JSON-LD whenever it finds Microdata or RDFa.
  • Schema Audit: every item on a page, its format and what's missing, with the same Convert to JSON-LD button.
  • JSON-LD Generator: build JSON-LD from a form when you'd rather start fresh than convert.