user2938881
user2938881

Reputation:

How to combine 2 JSON-LD Schema Types?

I need to combine both groups of JSON-LD so they are on the same page. Both a person and a local business. The goal isn't to necessarily relate the 2, but so they appear together.

Here is Group #1:

<script type="application/ld+json">
{
  "@context": "http://schema.org",
  "@type": "Person",
  "name": "John Doe",
  "jobTitle": "Graduate research assistant",
  "affiliation": "University of Dreams",
  "additionalName": "Johnny",
  "url": "http://www.example.com",
  "address": {
    "@type": "PostalAddress",
    "streetAddress": "1234 Peach Drive",
    "addressLocality": "Wonderland",
    "addressRegion": "Georgia"
  }
}
</script>

Here is Group #2:

<script type="application/ld+json">
{
  "@context": "http://schema.org",
  "@type": "Restaurant",
  "address": {
    "@type": "PostalAddress",
    "addressLocality": "Sunnyvale",
    "addressRegion": "CA",
    "postalCode": "94086",
    "streetAddress": "1901 Lemur Ave"
  },
  "aggregateRating": {
    "@type": "AggregateRating",
    "ratingValue": "4",
    "reviewCount": "250"
  },
  "name": "GreatFood",
  "openingHours": [
    "Mo-Sa 11:00-14:30",
    "Mo-Th 17:00-21:30",
    "Fr-Sa 17:00-22:00"
  ],
  "priceRange": "$$",
  "servesCuisine": [
    "Middle Eastern",
    "Mediterranean"
  ],
  "telephone": "(408) 714-1489",
  "url": "http://www.dishdash.com"
}
</script>

Right now Group #1 and Group #2 validate individually using Google's Structured Data Testing Tool.

Group 1

Group 2

Trying to combine these together and only the top group validates. The other doesn't show.

Combined

Help! How can these two groups be combined in the right way?

Upvotes: 0

Views: 1696

Answers (2)

Aree Cohen
Aree Cohen

Reputation: 31

<script type="application/ld+json">
{
  "@context": "http://schema.org",
  "@type": ["ItemList", "CreativeWork"],
  "name": "Top 5 covers of Bob Dylan Songs",
  "author": "John Doe",
  "about": {
    "@type": "MusicRecording",
    "byArtist": {
      "@type": "MusicGroup",
      "name": "Bob Dylan"
    }
  },

Upvotes: 1

Mousey
Mousey

Reputation: 1865

Is the acBoth can be nested within a http://schema.org/WebPage, mainEntity can be set to Person, and mentions can be set to Restaurant.

There probably is some kind of relationship between the person and Restaurant that would give a better fit, eg the Person may be the Author of the WebPage about the Restaurant, Or the accountablePerson for the WebPage, ate at the Restaurant (an action), is an employee, founder, or reviewed it.

Upvotes: 2

Related Questions