在此站点上工作时,我遇到了一个格式不正确的错误,希望能得到一些帮助。这是我正在使用的 json 文件。它很长,但我在第一行代码中遇到了错误(“product”:{“)。我昨天发布了这个,但人们要求我提供我正在使用的整个代码。
{
"product": {
"@attributes": {
"name": "Special Ops",
"price": "29.9900",
"currency": "$"
},
"views": {
"@attributes": {
"total": "2",
"etchingMaxChars": "20",
"defaultEtchingText": "",
"defaultLoad": "null,lenses|858388,frames|FFFFFF,left_clip|FFFFFF,right_clip|FFFFFF,left_gas|FFFFFF,right_gas|FFFFFF,adjuster|FFFFFF,strap|FFFFFF,null"
},
"viewcontainer": [
{
"@attributes": {
"name": "angledRight",
"type": "web/desktop",
"baseURLPath": "file:///C:/Users/.../goggles/specops_custom/VIEW_1_600X393",
"width": "600",
"height": "393",
"zoomFactor": "1.47"
},
"info": {
"@attributes": {
"txt": "About Special Ops Text goes here about the goggles."
}
},
"view": [
{
"@attributes": {
"inventoryAvail": "",
"prices": "5.0000",
"leftNav": "true",
"displayOrder": "3",
"group": "",
"layer": "laserEtching",
"dispName": "Laser Etching",
"options": "",
"maxCharacters": "20",
"fonts": "InterstateRegular",
"xPos": "0px",
"yPos": "-8px",
"svgPath": "M241.98,341.199c33.033,21.092,69.746,1.989,78.103-15.621",
"profanityFilterWords": ""
}
},
{
"@attributes": {
"inventoryAvail": "324.0000,370.0000,370.0000,366.0000,377.0000,360.0000,365.0000,321.0000",
"prices": "0,0,0,5,5,5,5,5",
"leftNav": "true",
"displayOrder": "2",
"group": "",
"layer": "lenses",
"dispName": "Polarized Lens",
"options": "Smoke,Clear,Blue,Amber|Purple|Mirror,Blue|Silver|Mirror,Smoke|Silver|Mirror,Red|Magenta|Mirror,Smoke|Red|Mirror",
"fullAssetURL": "/lenses/",
"id": "",
"colorHEX": "858388,B6ADB6,007DFA,6A4A7D,7B93AA,9E9193,DE0447,5E3343"
}
},
{
"@attributes": {
"inventoryAvail": "339.0000,354.0000,337.0000,361.0000,370.0000,335.0000,368.0000,369.0000,392.0000,328.0000",
"prices": "0,0,0,0,0,0,0,0,0,0",
"leftNav": "true",
"displayOrder": "1",
"group": "",
"layer": "frames",
"dispName": "Frame",
"options": "White,Green,Blue,Purple,Magenta,Red,Orange,Yellow,Clear|,Black",
"fullAssetURL": "/frames/",
"id": "",
"colorHEX": "FFFFFF,43DC1A,007DFA,4A0999,FF0066,FF0000,FF8400,F2D600,CFCFCF,000000"
}
},
{
"@attributes": {
"inventoryAvail": "350.0000,352.0000,348.0000,372.0000,376.0000,334.0000,364.0000,317.0000,392.0000,348.0000",
"prices": "0,0,0,0,0,0,0,0,0,0",
"leftNav": "true",
"displayOrder": "4",
"group": "",
"layer": "left_clip",
"dispName": "Left Frame Lock",
"options": "White,Green,Blue,Purple,Magenta,Red,Orange,Black,Clear|,Yellow",
"fullAssetURL": "/left_clip/",
"id": "",
"colorHEX": "FFFFFF,43DC1A,007DFA,4A0999,FF0066,FF0000,FF8400,000000,CFCFCF,F2D600"
}
},
{
"@attributes": {
"inventoryAvail": "352.0000,362.0000,348.0000,371.0000,376.0000,343.0000,352.0000,341.0000,390.0000,318.0000",
"prices": "0,0,0,0,0,0,0,0,0,0",
"leftNav": "true",
"displayOrder": "5",
"group": "",
"layer": "right_clip",
"dispName": "Right Frame Lock",
"options": "White,Green,Blue,Purple,Magenta,Red,Orange,Yellow,Clear|,Black",
"fullAssetURL": "/right_clip/",
"id": "",
"colorHEX": "FFFFFF,43DC1A,007DFA,4A0999,FF0066,FF0000,FF8400,F2D600,CFCFCF,000000"
}
},
{
"@attributes": {
"inventoryAvail": "363.0000,356.0000,341.0000,377.0000,371.0000,348.0000,355.0000,370.0000,391.0000,281.0000",
"prices": "0,0,0,0,0,0,0,0,0,0",
"leftNav": "true",
"displayOrder": "6",
"group": "",
"layer": "left_gas",
"dispName": "Left Gasket",
"options": "White,Green,Blue,Purple,Magenta,Red,Orange,Yellow,Clear|,Black",
"fullAssetURL": "/left_gas/",
"id": "",
"colorHEX": "FFFFFF,43DC1A,007DFA,4A0999,FF0066,FF0000,FF8400,F2D600,CFCFCF,000000"
}
},
{
"@attributes": {
"inventoryAvail": "365.0000,361.0000,340.0000,374.0000,379.0000,351.0000,356.0000,355.0000,390.0000,282.0000",
"prices": "0,0,0,0,0,0,0,0,0,0",
"leftNav": "true",
"displayOrder": "7",
"group": "",
"layer": "right_gas",
"dispName": "Right Gasket",
"options": "White,Green,Blue,Purple,Magenta,Red,Orange,Yellow,Clear|,Black",
"fullAssetURL": "/right_gas/",
"id": "",
"colorHEX": "FFFFFF,43DC1A,007DFA,4A0999,FF0066,FF0000,FF8400,F2D600,CFCFCF,000000"
}
},
{
"@attributes": {
"inventoryAvail": "307.0000,316.0000,308.0000,337.0000,350.0000,281.0000,332.0000,298.0000,362.0000,234.0000",
"prices": "0,0,0,0,0,0,0,0,0,0",
"leftNav": "true",
"displayOrder": "9",
"group": "",
"layer": "adjuster",
"dispName": "Strap Adjuster",
"options": "White,Green,Blue,Purple,Magenta,Red,Orange,Yellow,Clear|,Black",
"fullAssetURL": "/adjuster/",
"id": "",
"colorHEX": "FFFFFF,43DC1A,007DFA,4A0999,FF0066,FF0000,FF8400,F2D600,CFCFCF,000000"
}
},
{
"@attributes": {
"inventoryAvail": "366.0000,345.0000,344.0000,356.0000,378.0000,352.0000,368.0000,375.0000,382.0000,287.0000",
"prices": "0,0,0,0,0,0,0,0,0,0",
"leftNav": "true",
"displayOrder": "8",
"group": "",
"layer": "strap",
"dispName": "Strap",
"options": "White,Green,Blue,Purple,Magenta,Red,Orange,Yellow,Clear|,Black",
"fullAssetURL": "/strap/",
"id": "",
"colorHEX": "FFFFFF,43DC1A,007DFA,4A0999,FF0066,FF0000,FF8400,F2D600,CFCFCF,000000"
}
},
{
"@attributes": {
"inventoryAvail": "",
"prices": "",
"leftNav": "false",
"displayOrder": "",
"group": "",
"layer": "background",
"dispName": "",
"options": "background",
"id": "",
"colorHEX": ""
}
}
]
},
{
"@attributes": {
"name": "front",
"type": "web/desktop",
"baseURLPath": "file:///C:/Users/.../goggles/specops_custom/VIEW_2_650x252",
"width": "650",
"height": "252",
"zoomFactor": "1.37"
},
"info": {
"@attributes": {
"txt": "About Special Ops. More text about special ops"
}
},
"view": [
{
"@attributes": {
"inventoryAvail": "",
"prices": "5.0000",
"leftNav": "true",
"displayOrder": "3",
"group": "",
"layer": "laserEtching",
"dispName": "Laser Etching",
"options": "",
"maxCharacters": "20",
"fonts": "InterstateRegular",
"xPos": "-15px",
"yPos": "-58px",
"svgPath": "M467.503,168.446c18.426-3.05,49.64-19.418,43.423-58.752",
"profanityFilterWords": ""
}
},
{
"@attributes": {
"inventoryAvail": "324.0000,370.0000,370.0000,366.0000,377.0000,360.0000,365.0000,321.0000",
"prices": "0,0,0,5,5,5,5,5",
"leftNav": "true",
"displayOrder": "2",
"group": "",
"layer": "lenses",
"dispName": "Polarized Lens",
"options": "Smoke,Clear,Blue,Amber|Purple|Mirror,Blue|Silver|Mirror,Smoke|Silver|Mirror,Red|Magenta|Mirror,Smoke|Red|Mirror",
"fullAssetURL": "/lenses/",
"id": "",
"colorHEX": "858388,B6ADB6,007DFA,6A4A7D,7B93AA,9E9193,DE0447,5E3343"
}
},
{
"@attributes": {
"inventoryAvail": "339.0000,354.0000,337.0000,361.0000,370.0000,335.0000,368.0000,369.0000,392.0000,328.0000",
"prices": "0,0,0,0,0,0,0,0,0,0",
"leftNav": "true",
"displayOrder": "1",
"group": "",
"layer": "frames",
"dispName": "Frame",
"options": "White,Green,Blue,Purple,Magenta,Red,Orange,Yellow,Clear|,Black",
"fullAssetURL": "/frames/",
"id": "",
"colorHEX": "FFFFFF,43DC1A,007DFA,4A0999,FF0066,FF0000,FF8400,F2D600,CFCFCF,000000"
}
},
{
"@attributes": {
"inventoryAvail": "350.0000,352.0000,348.0000,372.0000,376.0000,334.0000,364.0000,317.0000,392.0000,348.0000",
"prices": "0,0,0,0,0,0,0,0,0,0",
"leftNav": "true",
"displayOrder": "4",
"group": "",
"layer": "left_clip",
"dispName": "Left Frame Lock",
"options": "White,Green,Blue,Purple,Magenta,Red,Orange,Black,Clear|,Yellow",
"fullAssetURL": "/left_clip/",
"id": "",
"colorHEX": "FFFFFF,43DC1A,007DFA,4A0999,FF0066,FF0000,FF8400,000000,CFCFCF,F2D600"
}
},
{
"@attributes": {
"inventoryAvail": "352.0000,362.0000,348.0000,371.0000,376.0000,343.0000,352.0000,341.0000,390.0000,318.0000",
"prices": "0,0,0,0,0,0,0,0,0,0",
"leftNav": "true",
"displayOrder": "5",
"group": "",
"layer": "right_clip",
"dispName": "Right Frame Lock",
"options": "White,Green,Blue,Purple,Magenta,Red,Orange,Yellow,Clear|,Black",
"fullAssetURL": "/right_clip/",
"id": "",
"colorHEX": "FFFFFF,43DC1A,007DFA,4A0999,FF0066,FF0000,FF8400,F2D600,CFCFCF,000000"
}
},
{
"@attributes": {
"inventoryAvail": "363.0000,356.0000,341.0000,377.0000,371.0000,348.0000,355.0000,370.0000,391.0000,281.0000",
"prices": "0,0,0,0,0,0,0,0,0,0",
"leftNav": "true",
"displayOrder": "6",
"group": "",
"layer": "left_gas",
"dispName": "Left Gasket",
"options": "White,Green,Blue,Purple,Magenta,Red,Orange,Yellow,Clear|,Black",
"fullAssetURL": "/left_gas/",
"id": "",
"colorHEX": "FFFFFF,43DC1A,007DFA,4A0999,FF0066,FF0000,FF8400,F2D600,CFCFCF,000000"
}
},
{
"@attributes": {
"inventoryAvail": "365.0000,361.0000,340.0000,374.0000,379.0000,351.0000,356.0000,355.0000,390.0000,282.0000",
"prices": "0,0,0,0,0,0,0,0,0,0",
"leftNav": "true",
"displayOrder": "7",
"group": "",
"layer": "right_gas",
"dispName": "Right Gasket",
"options": "White,Green,Blue,Purple,Magenta,Red,Orange,Yellow,Clear|,Black",
"fullAssetURL": "/right_gas/",
"id": "",
"colorHEX": "FFFFFF,43DC1A,007DFA,4A0999,FF0066,FF0000,FF8400,F2D600,CFCFCF,000000"
}
},
{
"@attributes": {
"inventoryAvail": "307.0000,316.0000,308.0000,337.0000,350.0000,281.0000,332.0000,298.0000,362.0000,234.0000",
"prices": "0,0,0,0,0,0,0,0,0,0",
"leftNav": "true",
"displayOrder": "9",
"group": "",
"layer": "adjuster",
"dispName": "Strap Adjuster",
"options": "White,Green,Blue,Purple,Magenta,Red,Orange,Yellow,Clear|,Black",
"fullAssetURL": "/adjuster/",
"id": "",
"colorHEX": "FFFFFF,43DC1A,007DFA,4A0999,FF0066,FF0000,FF8400,F2D600,CFCFCF,000000"
}
},
{
"@attributes": {
"inventoryAvail": "366.0000,345.0000,344.0000,356.0000,378.0000,352.0000,368.0000,375.0000,382.0000,287.0000",
"prices": "0,0,0,0,0,0,0,0,0,0",
"leftNav": "true",
"displayOrder": "8",
"group": "",
"layer": "strap",
"dispName": "Strap",
"options": "White,Green,Blue,Purple,Magenta,Red,Orange,Yellow,Clear|,Black",
"fullAssetURL": "/strap/",
"id": "",
"colorHEX": "FFFFFF,43DC1A,007DFA,4A0999,FF0066,FF0000,FF8400,F2D600,CFCFCF,000000"
}
},
{
"@attributes": {
"inventoryAvail": "",
"prices": "",
"leftNav": "false",
"displayOrder": "",
"group": "",
"layer": "background",
"dispName": "",
"options": "background",
"id": "",
"colorHEX": ""
}
}
]
}
]
}
}
}
然后这就是我使用 js 调用它的方式。
$j.getJSON(
"file:///C:/Users/.../specops.js",{},
function (d) {
$j.extend(tdata, d);
}
);
我对使用 json 等进行广泛的工作还很陌生,所以我确定我做错了什么。任何想法和帮助都会很棒。