Converting Structured Data Examples


It can be difficult to find structured data examples on the internet, especially when searching forums for answers and code to copy. Schema.org also has lots of microdata and RDFa examples without JSON-LD examples, which can be frustrating if you can’t read microdata or RDFa.

You can actually convert one type of structured data to another once you know how to “read” it.

Converting Microdata to JSON-LD

So you can convert this in microdata:

To this in JSON-LD:

In the microdata example we see <p itemscope itemtype=”https://schema.org/Museum”> which is the same thing as “@type”: “Museum”, in the JSON-LD.

We can see that the microdata <span itemprop=”name”>SF art museum.</span> is the same as the JSON-LD “name”: “SF art museum”, – this means that itemprop=”name” is the same thing as “name”.

The map section is a little bit harder, we have this in microdata – <span itemscope itemprop=”hasMap” itemtype=”https://schema.org/Map”> <link itemprop=”mapType” href=”https://schema.org/VenueMap” /> <a itemprop=”url” href=”/map1234/”>venue map</a></span>

Let’s break this down a little bit more:

<span itemscope itemprop=”hasMap” itemtype=”https://schema.org/Map”> – this part tells us that there is a structured data Type and a Property, which corresponds to this part of the JSON-LD: “hasMap”: { “@type”: “Map”, – the “hasMap” is the Property and the Type is “Map”.

This part of the microdata <link itemprop=”mapType” href=”https://schema.org/VenueMap” /> is the same as “mapType”: { “@id”: “https://schema.org/VenueMap” }, in the JSON-LD.

and then finally, the actual URL in the microdata is <a itemprop=”url” href=”/map1234/”>venue map</a> which corresponds with “url”: “http://art-sf.example.com/map1234/” in the JSON-LD. Notice that the microdata example uses a relative URL instead of an absolute URL like we need to do in the JSON-LD markup.


Converting RDFa to JSON-LD

In the same example, we also have RDFa markup which we can convert to JSON-LD:

This looks pretty similar to microdata, but it uses slightly different terminology.

In the RDFa example we see <p vocab=”https://schema.org/” typeof=”Museum”> which is the same thing as “@type”: “Museum”, in the JSON-LD.

We can see that the RDFa that <span property=”name”>SF art museum.</span> is the same as the JSON-LD “name”: “SF art museum”, – this means that span property=”name” is the same thing as “name”.

<span property=”hasMap” typeof=”Map”> – this part tells us that there is a structured data Type (typeof) and a Property, which corresponds to this part of the JSON-LD: “hasMap”: { “@type”: “Map”, – the “hasMap” is the Property and the Type is “Map”.

This part of the RDFa <link itemprop=”mapType” href=”https://schema.org/VenueMap” /> is the same as saying “mapType”: { “@id”: “https://schema.org/VenueMap” }, in the JSON-LD.

and then finally, the actual URL in the RDFa <a property=”url” href=”/map1234/”>venue map</a> which corresponds with “url”: “http://art-sf.example.com/map1234/” in the JSON-LD. Notice that the RDFa example uses a relative URL instead of an absolute URL like we need to do in the JSON-LD markup.


The longer examples can still be fairly difficult to read in any of the markup languages, but as you get more experience, you’ll learn to read between them a lot easier. It really helps when you can’t find a good example!

Categories: ,