How to read an external local JSON file in JavaScript?

前端 未结 22 1938
醉酒成梦
醉酒成梦 2020-11-22 02:53

I have saved a JSON file in my local system and created a JavaScript file in order to read the JSON file and print data out. Here is the JSON file:

{"res         


        
22条回答
  •  抹茶落季
    2020-11-22 03:17

    So, if you are planning to go with "Apache Tomcat" for hosting your JSON file,

    1> After starting up the server, verify that your Apache Tomcat is up and running by going to this url: "localhost:8080" -



    2> Next, go to the "webapps" folder - "C:\Program Files\Apache Software Foundation\Tomcat 8.5\webapps". And, create a project folder or copy your project folder.




    3> Paste your json file over there.



    4> And that's it. You are done! Just go to - "http://localhost:8080/$project_name$/$jsonFile_name$.json"

提交回复
热议问题