I have a file data.json. It has following data
[
"101 200",
"102 201",
"102 202",
"103 202"
]
How can I read this data using javascript? Notice it is not assigned to any variable and the name of the file ended up with .json but the data inside doesn’t look like json data.
Fetch the file using the
ajaxmethod (making sure that your server uses the correct Content-Type HTTP header (application/json) for the JSON file).When the result gets passed into the success handler, it will be presented as a JavaScript array.