3

I have got some JSON-LD here and getting errors which I can't fathom out and you guys are the ones with the know how :)

Here's the errors I'm getting (code at bottom):

  1. Missing ',' or '}' in object declaration (at the sameAs - line 7)

  2. When I check it on: http://json.parser.online.fr/

    I get the String parse:

    1 errorJS eval fails 
    SyntaxError: Unexpected token & in JSON at position 0
    
  3. When I check it on: http://jsonlint.com/

    I get:

    Error: Parse error on line 1:
    < script type = 'app
    ^
    Expecting 'STRING', 'NUMBER', 'NULL', 'TRUE', 'FALSE', '{', '[', got 'undefined'
    

I don't understand why as it looks (to my untrained eye!) that the script type is what everyone uses?

    <script type='application/ld+json'> 
{
  "@context": "schema dot org url",
  "@type": "JewelryStore",
  "name": "A.K. Campbell and Sons",
  "url": "company website jewellers url/”,
  "sameAs": [
    "youtube channel about url”, "google plus page url", "facebook url", "linkedin url", "twitter url"
  ],
  "logo": "photo url",
  "image": "image url",
  "description": "A.K. Campbell and Sons Jewellers of Kirkcaldy provides unique and bespoke gold, silver and diamond jewellery and jewellery services including valuations, pearl re-stringing and jewellery cleaning.",
  "address": {
    "@type": "PostalAddress",
    "streetAddress": "277 High Street",
    "addressLocality": "Kirkcaldy",
    "addressRegion": "Fife",
    "postalCode": "KY1 1JH",
    "addressCountry": "UK"
  },
  "geo": {
    "@type": "GeoCoordinates",
    "latitude": "56.11261",
    "longitude": "-3.15585"
  },
  "hasMap": "my map url - wasn't allowed to post it",
  "openingHours": "Mo, Tu, We, Th, Fr, Sa 10:00-16:00",
  "contactPoint": {
    "@type": "ContactPoint",
    "contactType": "customer service",
    "telephone": "+44 01592 264305"
  }
}
 </script>
2
  • Aside: How are you coding this? These sort of errors look like you are perhaps hand coding in a WYSIWYG type editor, instead of a code editor?
    – MrWhite
    Apr 6, 2017 at 9:16
  • You have the correct answer below but FYI your error in #3 is due to you pasting the script tag in there as well. You should have only put the JSON itself. Apr 8, 2017 at 18:17

1 Answer 1

6

You use instead of " two times:

  • Instead of

    "url": "company website jewellers url/”,
    

    it has to be

    "url": "company website jewellers url/",
    
  • Instead of

    "sameAs": [
        "youtube channel about url”, "google plus page url", "facebook url", "linkedin url", "twitter url"
    ],
    

    it has to be

    "sameAs": [
        "youtube channel about url", "google plus page url", "facebook url", "linkedin url", "twitter url"
    ],
    

Not the answer you're looking for? Browse other questions tagged or ask your own question.