0

Excuse my lack of knowledge as i have never dealt with JSON arrays. I'm trying to load a JSON file data into a Typescript variable so i can do a certain treatment that uses arrays, but i have no idea how to do it, here's how the data is stored in my JSON file:

{"Array1":["A","B","C","D"] , "Array2":["W","X","Y","Z"]} //2 arrays

i want to have to keep the data exactly how it is so i can use it to loop through the arrays in my file. Any help will be appreciated

  • does this answer your question? https://stackoverflow.com/questions/7346563/loading-local-json-file – Ethan Lipkind Jun 04 '20 at 14:24
  • JavaScript on the web doesn't have access to the local filesystem. If you're doing this from a browser, you'll need to fetch the file from a server. – lux Jun 04 '20 at 15:10
  • Does this answer your question? [Loading local JSON file](https://stackoverflow.com/questions/7346563/loading-local-json-file) – Joshua Mire Jun 05 '20 at 02:41

1 Answers1

1
JSON.parse('{"Array1":["A","B","C","D"] , "Array2":["W","X","Y","Z"]}')