JSON-在其他类型中使用类型时 SDTT 中的 LD 错误:"Missing ',' or ']' in array declaration."
JSON-LD error in SDTT when using types inside of other types: "Missing ',' or ']' in array declaration."
我目前正在尝试使用 @graph
通过 JSON-LD 同时应用 WebSite
和 Organization
Schema.org,我 运行 进入我不理解的语法问题。我不是 Javascript 开发人员,只是 HTML 和 CSS 的人,所以我真的不知道发生了什么。
在 Google 的结构化数据测试工具中,我在第 11 行遇到错误:
Missing ',' or ']' in array declaration.
但是我已经经历了很多次了,我无法理解这个问题。我已经尝试重新排列所有括号并在这里和那里移动东西,似乎每次我消除错误时,都会出现另一个错误。这是迄今为止我得到的最好的代码版本。
在其他 @type
中使用 @type
时似乎出现了问题。
{
"@context" : "http://schema.org",
"@graph" :
[
{
"@type" : "WebSite",
"url" : "https://www.bcsauto.com",
"name" : "BCS Auto",
"author" :
[
"@type" : "Person",
"name" : "Justin Hilliard"
],
"description" : "Your NEW source for Late Model Camaro Parts & Accessories!",
"publisher" : "Justin Hilliard ",
"potentialAction" :
[
"@type" : "SearchAction",
"target" : "https://shop.bcsauto.com/search.html?q={search_term}&go=Search",
"query-input" : "required name=search_term"
]
},
{
"@type" : "Organization",
"name" : "BCS Auto",
"url" : "http://www.bcsauto.com",
"logo" : "https://shop.bcsauto.com/files/images/logo.png",
"foundingDate" : "2016",
"founders":
[
{
"@type": "Person",
"name": "Justin Hilliard"
},
],
},
{
"@type" : "ContactPoint",
"contactType" : "Sales",
"telephone" : "[+1-602-730-6415]",
"email" : "sales@bcsauto.com",
"areaServed" : "US"
},
{
"@type" : "ContactPoint",
"contactType" : "Customer Support",
"telephone" : "[+1-602-730-6415]",
"email" : "support@bcsauto.com",
"areaServed" : "US",
"sameAs" :
[
"https://www.facebook.com/OfficialBCSAuto",
"https://instagram.com/officialbcsauto",
"https://www.linkedin.com/company/bcsauto"
]
}
]
}
"author" :
[
"@type" : "Person",
"name" : "Justin Hilliard"
],
"potentialAction" :
[
"@type" : "SearchAction",
"target" : "https://shop.bcsauto.com/search.html?q={search_term}&go=Search",
"query-input" : "required name=search_term"
]
[
]
用于数组,{
}
用于对象。在上面的片段中,你有对象,所以你必须使用大括号而不是方括号。
"founders":
[
{
"@type": "Person",
"name": "Justin Hilliard"
},
],
在上面的代码片段中,您有一个只有一个对象的数组。无论是否保留数组(只有一个值,不需要),都必须删除最后两个,
,因为对象是数组中的最后一个值,而数组是中的最后一个值父对象。
感谢@unor,我才能够解决这个问题!我混淆了我的括号和卷曲的小括号,因为我不理解数组和对象。
{
"@context": "http://schema.org",
"@graph": [
{
"@type": "WebSite",
"url": "https://www.bcsauto.com",
"name": "BCS Auto",
"author": {
"@type": "Person",
"name": "Justin Hilliard"
},
"description": "Your NEW source for Late Model Camaro Parts & Accessories!",
"publisher": {
"@type": "Person",
"name": "Justin Hilliard"
},
"potentialAction": {
"@type": "SearchAction",
"target": "https://shop.bcsauto.com/search.html?q={search_term}&go=Search",
"query-input": "required name=search_term"
}
},
{
"@type": "Organization",
"name": "BCS Auto",
"url": "http://www.bcsauto.com",
"logo": "https://shop.bcsauto.com/files/images/logo.png",
"foundingDate": "2016",
"founders": {
"@type": "Person",
"name": "Justin Hilliard"
},
"ContactPoint": [
{
"@type": "ContactPoint",
"contactType": "Sales",
"telephone": "[+1-602-730-6415]",
"email": "sales@bcsauto.com",
"areaServed": "US"
},
{
"@type": "ContactPoint",
"contactType": "Customer Support",
"telephone": "[+1-602-730-6415]",
"email": "support@bcsauto.com",
"areaServed": "US",
"sameAs": [
"https://www.facebook.com/OfficialBCSAuto",
"https://instagram.com/officialbcsauto",
"https://www.linkedin.com/company/bcsauto"
]
}
]
}
]
}
我目前正在尝试使用 @graph
通过 JSON-LD 同时应用 WebSite
和 Organization
Schema.org,我 运行 进入我不理解的语法问题。我不是 Javascript 开发人员,只是 HTML 和 CSS 的人,所以我真的不知道发生了什么。
在 Google 的结构化数据测试工具中,我在第 11 行遇到错误:
Missing ',' or ']' in array declaration.
但是我已经经历了很多次了,我无法理解这个问题。我已经尝试重新排列所有括号并在这里和那里移动东西,似乎每次我消除错误时,都会出现另一个错误。这是迄今为止我得到的最好的代码版本。
在其他 @type
中使用 @type
时似乎出现了问题。
{
"@context" : "http://schema.org",
"@graph" :
[
{
"@type" : "WebSite",
"url" : "https://www.bcsauto.com",
"name" : "BCS Auto",
"author" :
[
"@type" : "Person",
"name" : "Justin Hilliard"
],
"description" : "Your NEW source for Late Model Camaro Parts & Accessories!",
"publisher" : "Justin Hilliard ",
"potentialAction" :
[
"@type" : "SearchAction",
"target" : "https://shop.bcsauto.com/search.html?q={search_term}&go=Search",
"query-input" : "required name=search_term"
]
},
{
"@type" : "Organization",
"name" : "BCS Auto",
"url" : "http://www.bcsauto.com",
"logo" : "https://shop.bcsauto.com/files/images/logo.png",
"foundingDate" : "2016",
"founders":
[
{
"@type": "Person",
"name": "Justin Hilliard"
},
],
},
{
"@type" : "ContactPoint",
"contactType" : "Sales",
"telephone" : "[+1-602-730-6415]",
"email" : "sales@bcsauto.com",
"areaServed" : "US"
},
{
"@type" : "ContactPoint",
"contactType" : "Customer Support",
"telephone" : "[+1-602-730-6415]",
"email" : "support@bcsauto.com",
"areaServed" : "US",
"sameAs" :
[
"https://www.facebook.com/OfficialBCSAuto",
"https://instagram.com/officialbcsauto",
"https://www.linkedin.com/company/bcsauto"
]
}
]
}
"author" :
[
"@type" : "Person",
"name" : "Justin Hilliard"
],
"potentialAction" :
[
"@type" : "SearchAction",
"target" : "https://shop.bcsauto.com/search.html?q={search_term}&go=Search",
"query-input" : "required name=search_term"
]
[
]
用于数组,{
}
用于对象。在上面的片段中,你有对象,所以你必须使用大括号而不是方括号。
"founders":
[
{
"@type": "Person",
"name": "Justin Hilliard"
},
],
在上面的代码片段中,您有一个只有一个对象的数组。无论是否保留数组(只有一个值,不需要),都必须删除最后两个,
,因为对象是数组中的最后一个值,而数组是中的最后一个值父对象。
感谢@unor,我才能够解决这个问题!我混淆了我的括号和卷曲的小括号,因为我不理解数组和对象。
{
"@context": "http://schema.org",
"@graph": [
{
"@type": "WebSite",
"url": "https://www.bcsauto.com",
"name": "BCS Auto",
"author": {
"@type": "Person",
"name": "Justin Hilliard"
},
"description": "Your NEW source for Late Model Camaro Parts & Accessories!",
"publisher": {
"@type": "Person",
"name": "Justin Hilliard"
},
"potentialAction": {
"@type": "SearchAction",
"target": "https://shop.bcsauto.com/search.html?q={search_term}&go=Search",
"query-input": "required name=search_term"
}
},
{
"@type": "Organization",
"name": "BCS Auto",
"url": "http://www.bcsauto.com",
"logo": "https://shop.bcsauto.com/files/images/logo.png",
"foundingDate": "2016",
"founders": {
"@type": "Person",
"name": "Justin Hilliard"
},
"ContactPoint": [
{
"@type": "ContactPoint",
"contactType": "Sales",
"telephone": "[+1-602-730-6415]",
"email": "sales@bcsauto.com",
"areaServed": "US"
},
{
"@type": "ContactPoint",
"contactType": "Customer Support",
"telephone": "[+1-602-730-6415]",
"email": "support@bcsauto.com",
"areaServed": "US",
"sameAs": [
"https://www.facebook.com/OfficialBCSAuto",
"https://instagram.com/officialbcsauto",
"https://www.linkedin.com/company/bcsauto"
]
}
]
}
]
}