Parse local JSON file with jQuery and Javascript

前端 未结 2 1432
说谎
说谎 2021-01-18 02:38

I\'m trying to parse a JSON file located on my computer. I want to parse it. The JSON file has this structure:

{
  \"sites\": {
    \"site\": [
      {
              


        
2条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-01-18 02:43

    getJSON will parse it for you.

    Just remove the var obj = $.parseJSON(json); line (since that will stringify the object and try to parse it as JSON (which it won't be)).

提交回复
热议问题