Reputation: 275
I like to add json-ld to my website before that I want to add it to my dev site to test it
<script type="application/ld+json">
{
"@context": "http://schema.org",
"@type": "Organization",
"url": "xxxxxxxxxxxxxxxx",
"contactPoint": [{
"@type": "ContactPoint",
"telephone": "+xx-xxx-xxx-xxxx",
"contactType": "customer service"
}]
}
</script>
I get the error stating that Missing '}' or object member name. what is this error,I have closed brackets correctly.how to fix it kindly help
Upvotes: 19
Views: 34926
Reputation: 1
I encounter the same problem, but this is not just all about extra commas and spacing.
just change this:
{
"@context": "http://schema.org",
"@type": "Organization",
"url": "xxxxxxxxxxxxxxxx",
"contactPoint": [{
"@type": "ContactPoint",
"telephone": "+xx-xxx-xxx-xxxx",
"contactType": "customer service"
}]
}
to this:
{
"@context": "https://schema.org",
"@type": "Organization",
"url": "xxxxxxxxxxxxxxxx",
"contactPoint": [{
"@type": "ContactPoint",
"telephone": "+xx-xxx-xxx-xxxx",
"contactType": "customer service"
}]
}
The problem simply occurs because yours is "http://schema.org", and it must be changed to "https://schema.org"
Upvotes: 0
Reputation: 449
I had the same issue and it was simply a case of removing trailing spaces that were after a comma.
Specifically "ratingValue": "4.9",
became "ratingValue": "4.9",
in this block:
"aggregateRating":
{
"@type": "AggregateRating",
"ratingValue": "4.9",
"bestRating": "5",
"reviewCount": "91"
}
Upvotes: 1
Reputation: 580
The Rich Result Test tool also shows this error for large JsonLD inputs.
I wonder if this is just a limitation of the test tool or google crawlers also follow this rule.
Upvotes: 1
Reputation: 1
Same problem happened to me. In my case, it works just deleting the last coma after "" and putting and the end after }
.
"contactType": "customer service" <==
(YOU DONT HAVE COMMA HERE, BUT IF THIS IS THE CASE YOU SHOULD DELETE THE COMA)
}], <==(AND PUT IT HERE)
}, <==(OR HERE, YOU JUST TRY IT)
Upvotes: 0
Reputation: 578
If your schema have this
"
then try to replace it with normal
"
Upvotes: 1
Reputation: 3469
I faced the same issue and found a unusual reason for the error. In my case an unknown blank character was causing the issue.
I simply replaced all those unknown blank characters with spaces and it worked for me.
Se attached images.
Upvotes: 5
Reputation: 51
I ran into the exact same issue. The JSON-LD markup has nothing to do with trailing commas after the last element, etc. Yours is absolutely correct.
However, please note that single quotes or ''
are not accepted by Google. You must use double quotes or ""
for each and every key and value, including the elements in an array and not the array itself.
Upvotes: 5
Reputation: 4016
Usually this error is because of unneeded commas, make sure to remove the trailing comma from all last elements in every { } block.
Example snippet:
<script type="application/ld+json">
{
"@context": "http://schema.org",
"@type": "Article",
"mainEntityOfPage": {
"@type": "WebPage",
"@id": "http://foo.bar", // Remove comma here
}, // Remove comma here
// Add other required fields if necessary
}
</script>
Upvotes: 52
Reputation: 3823
This snippet is completely fine. It is both valid JSON as well as valid JSON-LD. You can test it with the JSON-LD playground and Google's Structured Data Testing tool.
Upvotes: 9