JSON-LD Missing '}' or object member name. error

sudan kanakavel picture sudan kanakavel · Jun 27, 2016 · Viewed 19.6k times · Source

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

Answer

P-S picture P-S · Feb 18, 2017

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>