I want to read a JSON file that in my local machinge using Javescript, and parse it to a Javascript object such as this code:
var parsed = JSON.parse(JSON_file);
Is it possible to read the file from the disk? Or there is other methods to do that. Thanks.
Here is a nice tutorial on how you can do it using HTML5's FileReader API, but there is one constraint: you can only interact with a file selected by the user via a file input field.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.