2014-05-12 99 views
0

誰能告訴我爲什麼我的JSON文件在解析時拋出錯誤?我想用卡丁車製作一張地圖?我得到使用的JSLint(如下)這些錯誤我的JSON代碼有什麼問題?

{ 
    "proj": { "id": "sinusoidal", 
    "lon0": 134.25}, 
    "layers": [ 
    { 
     "background": {"special": "sea"}, 
     "styles": {"fill": "lightblue"} 
    }, 
    { 
     "graticule": {"special": "graticule", 
     "latitudes": 1, 
     "longitudes": 1} 
    }, 
    { "id": "Aus" 
     "src": "myfile" 
     "simplify": false 
     }, 
    { "id": "trees", 
     "src": "myfile", 
     "simplify": true }, 
    {'id': 'crops' 
     "src": "myfile", 
     "simplify": true 
    }, 
    { "id": "depth" 
     "src": "myfile", 
     "simplify": true 
    }, 
    { "id": "states", 
     "src": "myfile"} 
    ], 

    "export": { 
    "width": "auto", 
    "height": "auto" 
    }, 
    "bounds": { 
    "padding": 0.02, 
    "mode": "bbox", 
    "data": [92, -44, 181, -2], 
    "crop": [112, -44, 154, -9] 

    } 
} 

的錯誤,我GT使用的JSLint是

Line 14, column 8: Expected '}' to match '{' from line 13 and instead saw 'src'. 
      "src": "myfile" 

Line 14, column 13: Expected ']' to match '[' from line 3 and instead saw ':'. 
      "src": "myfile" 

Line 14, column 15: Expected '}' to match '{' from line 1 and instead saw 'D:/karto/Aus/Ausfull/Ausfull.shp'. 
      "src": "myfile" 

Line 15, column 8: Expected '(end)' and instead saw 'simplify'. 
      "simplify": false 

* do'nt瞭解如何解決這些錯誤?

+2

你錯過了很多逗號。 – Pointy

+1

你在那個區域缺少'',''。 –

+0

'{「id」:「Aus」「src」:「myfile」「simplify」:false}'缺少一些','s。 –

回答

3

字符串必須用雙引號,你錯過了一些逗號

{ 
     "proj": { 
      "id": "sinusoidal", 
       "lon0": 134.25 
     }, 
      "layers": [{ 
      "background": { 
       "special": "sea" 
      }, 
       "styles": { 
       "fill": "lightblue" 
      } 
     }, { 
      "graticule": { 
       "special": "graticule", 
        "latitudes": 1, 
        "longitudes": 1 
      } 
     }, { 
      "id": "Aus", 
       "src": "myfile", 
       "simplify": false 
     }, { 
      "id": "trees", 
       "src": "myfile", 
       "simplify": true 
     }, { 
      "id": "crops", 
       "src": "myfile", 
       "simplify": true 
     }, { 
      "id": "depth", 
       "src": "myfile", 
       "simplify": true 
     }, { 
      "id": "states", 
       "src": "myfile" 
     }], 

      "export": { 
      "width": "auto", 
       "height": "auto" 
     }, 
      "bounds": { 
      "padding": 0.02, 
       "mode": "bbox", 
       "data": [92, -44, 181, -2], 
       "crop": [112, -44, 154, -9] 

     } 
    } 
+0

謝謝問題解決了:) – user343

+0

標記你的答案 –