JSON+Javascript/jQuery. How to import data from a json file and parse it?

前端 未结 7 1997
猫巷女王i
猫巷女王i 2021-01-31 19:12

If I have a JSON file named names.json with:

{\"employees\":[
    {\"firstName\":\"Anna\",\"lastName\":\"Meyers\"},
    {\"firstNam         


        
7条回答
  •  深忆病人
    2021-01-31 19:57

    Your JSON file does not contain valid JSON. Try the following instead.

     {
         "employees": 
         [
             {
                 "firstName": "Anna",
                 "lastName": "Meyers"
             },
             {
                 "firstName": "Betty",
                 "lastName": "Layers"
             },
             {
                 "firstName": "Carl",
                 "lastName": "Louis"
             }
         ]
     }
    

    You should then see a response. Check out http://jsonlint.com/

提交回复
热议问题