0

I am working a nodejs back-end project. So I have a json file tryList.json saved in public folder. Also in the folder, I have a html file. What should I put in the tag of the html file so that I can load the data from tryList.json?

I am trying to import the data into the front end js code, which will be used in data visualization later.

Thanks

TechSelfLearner
  • 369
  • 1
  • 13
  • I don't *think* you can do this with just a tag. You could easily do this with some JavaScript, using an AJAX/`XMLHttpRequest` call, and calling `JSON.parse()` on the retrieved data. Alternatively, you could use something like webpack to embed the JSON in a JavaScript file or webpack with EJS (or another templating system) to embed directly into the outputted HTML file. – dx_over_dt Mar 07 '20 at 18:33
  • Does this answer your question? [HTML/Javascript: how to access JSON data loaded in a script tag with src set](https://stackoverflow.com/questions/13515141/html-javascript-how-to-access-json-data-loaded-in-a-script-tag-with-src-set) – dx_over_dt Mar 07 '20 at 18:38

0 Answers0