Reputation: 1251
I'm currently building an API that will generate a JSON-LD output that will be used by schema.org.
I'm looking for some clarification on how exactly I need to format the JSON, based on the data that I have.
I have a bunch of Events. They have a start and end date/time. They have a name/title and description.
Each event has "sub events". For example:
Russian Ballet
- Russian Ballet Monday
- Russian Ballet Tuesday
Arts Exhibition
- Arts Exhibition Thursday
The Events and their "sub events" are one-off events.
I've seen the subEvent
, eventSchedule
and offers
(each sub event is a ticket - with no price though)
Which do I use? I kind of need some of each, but unsure how to nest the event data
Thanks
Upvotes: 0
Views: 614
Reputation: 7781
An Event that is part of this event. For example, a conference event includes many presentations, each of which is a subEvent of the conference. https://schema.org/subEvent
In general, no way to give you one example to suit all situations.
You can nest sub-event inside sub-event inside...inside...
In this example Child event one
with two sub-events.
<script type="application/ld+json">
{
"@context":"http://schema.org",
"@type":"Event",
"name":"Parent event",
"subEvent":[
{
"@type":"Event",
"name":"Child event one",
"subEvent":[
{
"@type":"Event",
"name":"Grandchild one"
},
{
"@type":"Event",
"name":"Grandchild two"
}
]
},
{
"@type":"Event",
"name":"Child event two"
}
]
}
}
</script>
(eventSchedule inside subevent. subevent inside event)
eventSchedule
data added to sub-event one
(Child of Parent event).
<script type="application/ld+json">
{
"@context":"http://schema.org",
"@type":"Event",
"name":"Event name - FIFA World Cup 2020",
"subEvent":[
{
"@type":"Event",
"name":"sub-event one",
"eventSchedule":{
"@type":"Schedule",
"startDate":"2017-01-01",
"endDate":"2017-12-31",
"repeatFrequency":"P1W",
"byDay":"http://schema.org/Wednesday",
"startTime":"19:00",
"endTime":"20:00",
"scheduleTimezone":"Europe/London"
}
},
{
"@type":"Event",
"name":"sub-event name"
}
]
}
}
</script>
**(Missing some properties for shorter code)
FIFA World cup
event with 3 sub-events
<script type="application/ld+json">
{
"@context": "http://schema.org",
"@type": "Event",
"name": "FIFA World Cup 2020",
"startDate": "2020-09",
"endDate": "2020-11",
"location": {
"@type": "Place",
"address": {
"@type": "PostalAddress",
"addressLocality": "London",
"postalCode": "80209",
"streetAddress": "7 S. Broadway"
},
"name": "London Place Name"
},
"offers": {
"@type": "Offer",
"price": "13.00",
"priceCurrency": "USD",
"url": "http://www.ticketfly.com/purchase/309433"
},
"subEvent": [
{
"@type": "Event",
"name": "Quarter final - FIFA World Cup 2020",
"description": "lorem ipsum",
"startDate": "2020-09",
"endDate": "2020-09",
"location": {
"@type": "Place",
"name": "London Place Name",
"address": {
"@type": "PostalAddress",
"streetAddress": "7 S. Broadway"
}
}
},
{
"@type": "Event",
"name": "Semi final - FIFA World Cup 2020",
"description": "lorem ipsum",
"startDate": "2020-10",
"endDate": "2020-10",
"location": {
"@type": "Place",
"name": "London Place Name",
"address": {
"@type": "PostalAddress",
"streetAddress": "7 S. Broadway"
}
}
},
{
"@type": "Event",
"name": "Final - FIFA World Cup 2020",
"description": "lorem ipsum",
"startDate": "2020-10",
"endDate": "2020-10",
"location": {
"@type": "Place",
"name": "London Place Name",
"address": {
"@type": "PostalAddress",
"streetAddress": "7 S. Broadway"
}
}
}
]
}
</script>
Google Email Markup Tester output screenshot:
The idea of nesting object her not diff from any other nesting data on schema.org (So each tutorial you read about this topic could be helpful for you). Start with simple examples like:
Upvotes: 3