Combine multiple Json Schema


If you are wondering how to combine several Json schemas into one in wordpress, the solution is to use the new Platinum SEO WordPress Plugin. This wordpress seo plugin makes it very easy for you to add json schema to each post or page. All you have to do is to generate Json Schema by using our Json Schema Editor and copy paste the schema in the Json editor present within the advanced tab of Platinum SEO Metabox of our wordpress seo plugin. But what if you want to create multiple schema markups for a post or page? How do you combine Json Schema markups and add them into the aforesaid editor?

There are three methods for joining Json Schema markups. Combining Json schema means you will have to specify multiple top-level schema items.

Specifying multiple schemas as arrays in the Json editor

The first method is to specify them as arrays. Platinum SEO wordpress Plugin supports this method. See the below example of a Json schema with multiple top level items or types.

<script type="application/ld+json">
[
  {
     "@context": "http://schema.org",
     "@type": "Article"
  },
  {
     "@context": "http://schema.org",
     "@type": "Organisation"
  },
  {
     "@context": "http://schema.org",
     "@type": "Person"
  }
]
</script>

Here each schema for a top-level item or type is specified as a separate array. The arrays are separated by commas. All you have to do is generate individual schema array using our Json Schema generator and combine them as comma separated arrays before adding them to the Json Schema Editor in the advance tab of platinum SEO metabox. Note that you shouldn’t be specifying the script tag in the plugin’s Json editor. i.e. for the above example, you only need to enter the following code in the Json editor of Platinum SEO wordpress plugin..

 {
     "@context": "http://schema.org",
     "@type": "Article"
  },
  {
     "@context": "http://schema.org",
     "@type": "Organisation"
  },
  {
     "@context": "http://schema.org",
     "@type": "Person"
  }

You will see that the @context is repeated for each schema. But this will be successfully validated by the Json Schema Validator as it is an accepted method to combine schemas.

Using @graph to specify the multiple schemas in the Json editor

This is a small modification of the first method wherein @context is specified only once and a @graph key is used to specify the multiples schemas as arrays i.e. schemas with their own @type top-level item.

<script type="application/ld+json">
{
	"@context": "http://schema.org",
	"@graph": 
			[
			  {
				 "@type": "Article",
			  },
			  {
				 "@type": "Organisation",
			  },
			  {
				 "@type": "Person",
			  }
			]
}
</script>

You can edit the combined schemas shown above as follows in the Json schema editor of Platinum SEO wordpress plugin (without the script tags). But this editing is optional and is not necessary to get the schema validated. It is an option only for those who are well versed in editing Json schema.


{
	"@context": "http://schema.org",
	"@graph": 
			[
			  {
				 "@type": "Article",
			  },
			  {
				 "@type": "Organisation",
			  },
			  {
				 "@type": "Person",
			  }
			]
}

Specifying several Json schemas as separate script elements

In this method each generated Json schema is specified as a separate json ld script element. Here we use multiple script elements and the @context is also repeated for each json script element. This method is not supported by platinum seo wordpress plugin.

<script type="application/ld+json">
{
  "@context": "http://schema.org",
  "@type": "Article"
}
</script>

<script type="application/ld+json">
{
  "@context": "http://schema.org",
  "@type": "Organisation"
}
</script>

<script type="application/ld+json">
{
  "@context": "http://schema.org",
  "@type": "Person"
}
</script>

Grouping Json schema markups

This can be done by Specifying one top level item and nesting the other top level items under it against suitable properties. Take a look at the following example.

<script type="application/ld+json">
{
  "@context": "http://schema.org",
  "@type": "WebPage",
  "provider": 
  {
    "@type": "Organization",	
  },
  "author": 
  {
    "@type": "Person",
  },
  "breadcrumb": 
  {
    "@type": "BreadcrumbList",
  }
}
</script>

Here one top level item "WebPage" is specified at the top and other relevant top level items are grouped under it as properties. "Organization" schema is specified against the property "provider", "person" schema is specified against the property "author" and "BreadcrumbList" schema is specified against the property "breadcrumb".

Hope you enjoy our Json editor within Platinum SEO wordpress plugin and our Json Schema Generator.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

Recommended Videos

Using the Qlik REST Connector - Pagination and Multiple JSON Schemas
Using the Qlik REST Connector - Pagination and Multiple JSON Schemas
JSON Basics JSON multiple objects within JSON files
JSON Basics JSON multiple objects within JSON files
Python Tutorial: Working with JSON Data using the json Module
Python Tutorial: Working with JSON Data using the json Module
Flat File to Json conversion in Mule 4
Flat File to Json conversion in Mule 4
Azure Data Factory: Merge Files with Mapping Data Flows
Azure Data Factory: Merge Files with Mapping Data Flows