Forum Moderators: open

Message Too Old, No Replies

Need help validating JSON Schema for 2 events, different locations

         

Lorel

10:48 pm on Feb 6, 2020 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



I've been working on this all day, tried 3 different validators.
This is an event schema for 2 different similar events in two different days and locations
Can someone tells me what's wrong with my code?

Here is the error I'm getting (where the one event ends and the other begins).
I've checked similar examples of 2 events and they are written the same:

JSON markup - SyntaxError: JSON.parse: expected double-quoted property name at line 24 column 9 of the JSON data

{
"@context": "http://schema.org",
"@type": "Event",
"name": "Speaking Event",
"description": "Come join us for a fun-filled presentation as ",
"image": "https://www.example.com/images/event-schema.jpg",

"offers": [
{
"@type": "ComedyEvent",
"startDate": "2020-09-28T19:00",
"isAccessibleForFree": "True",
"location": {
"@type": "Place",
"name": "Library",
"sameAs": "https://example.com/",
"address": {
"@type": "PostalAddress",
"addressLocality": "city",
"addressRegion": "state",
"postalCode": "zip",
"streetAddress": "Street"
}
},{
"@type": "ComedyEvent",
"startDate": "2020-10-01T19:00",
"isAccessibleForFree": "True",
"location": {
"@type": "Place",
"name": "Library",
"url": "https://www.example.com/",
"address": {
"@type": "PostalAddress",
"addressLocality": "City",
"addressRegion": "State",
"postalCode": "zip",
"streetAddress": "Street"
}
}
]
}

lammert

11:01 pm on Feb 6, 2020 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



You are missing a } in each event. "address" is properly terminated and "location" also, but the main { for each event has no terminating }.

Fotiman

11:49 pm on Feb 6, 2020 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



This is where it would help to format it nicely, with proper indentation. Then the error becomes much more obvious. You're missing the closing } on each "location" (where the empty lines are below):

{
"@context": "http://schema.org",
"@type": "Event",
"name": "Speaking Event",
"description": "Come join us for a fun-filled presentation as ",
"image": "https://www.example.com/images/event-schema.jpg",
"offers": [
{
"@type": "ComedyEvent",
"startDate": "2020-09-28T19:00",
"isAccessibleForFree": "True",
"location": {
"@type": "Place",
"name": "Library",
"sameAs": "https://example.com/",
"address": {
"@type": "PostalAddress",
"addressLocality": "city",
"addressRegion": "state",
"postalCode": "zip",
"streetAddress": "Street"
}

},{
"@type": "ComedyEvent",
"startDate": "2020-10-01T19:00",
"isAccessibleForFree": "True",
"location": {
"@type": "Place",
"name": "Library",
"url": "https://www.example.com/",
"address": {
"@type": "PostalAddress",
"addressLocality": "City",
"addressRegion": "State",
"postalCode": "zip",
"streetAddress": "Street"
}

}
]
}

[edited by: Fotiman at 12:01 am (utc) on Feb 7, 2020]

Fotiman

11:58 pm on Feb 6, 2020 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Side note: it's been a long time since I've posted code in this forum. I forgot how difficult it is on this site.

Lorel

4:16 pm on Feb 7, 2020 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



@Foitman and @Lammert

I thought address was part of Location and thus my confusion.

I got it to validate now.

thanks for your help.

Lorel

6:22 pm on Feb 10, 2020 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



I'm still having problems with listing 2 events in two separate places and dates in schema. It validated in Google's own schema validaor but when I try to post it to GSC's url inspection tool, Google is wanting the date and location under @ype": "event" when I already have it listed under the two separate "comedyEvent" listings.

I went ahead and inserted one of the dates (and one error went away) but it's still wanting location.

<code>
{
"@context": "http://schema.org",
"@type": "Event",
"name": "event name",
"description": "event description",
"image": "event.jpg",
"startDate": "2020-09-28T19:00",
"performer": {
"@type": "Person",
"name": "name"
},
"offers": [
{
"@type": "ComedyEvent",
"name": "event name",
"startDate": "2020-09-28T19:00",
"isAccessibleForFree": "True",
"location": {
"@type": "Place",
"name": "Library",
"sameAs": "example.com/",
"address": {
"@type": "PostalAddress",
"addressLocality": "city",
"addressRegion": "state",
"postalCode": "zip",
"streetAddress": "address"
}
}
},{
"@type": "ComedyEvent",
"name": "event name",
"startDate": "2020-09-28T19:00",
"isAccessibleForFree": "True",
"location": {
"@type": "Place",
"name": "Library",
"sameAs": "example.com/",
"address": {
"@type": "PostalAddress",
"addressLocality": "city",
"addressRegion": "state",
"postalCode": "zip",
"streetAddress": "address"
}
}
}
]
}
</code>

Anyone else experience this?

Lorel

7:56 pm on Feb 11, 2020 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



I did some more research and discovered I could use @graph instead of @offers and it validated and GSC accepted it also. I'll report back once it shows up in search.