0

I have a JSON file and a separate javascript file. How can I take all the data from json in javascript, without Node.js, and show the data filtered after some criteria in html? For example I have the data bellow in JSON file, I want to take it to javascript, in javascript I want to filter it, by taking only the even lines and then I want to show the even lines in html.

{
    "numbers":[
        {
            "id":1,"arr":[4,23,28,33,37,40]
        },
        {
            "id":2,"arr":[1,33,2,13,4,23,44,5,6]
        },
        {
            "id":3, "arr":[12,43,24,26,2]
        },
        {
            "id":4, "arr":[46,41,27,20,56,68]
        },
        {
            "id":5,  "arr":[46,69,70,84,92,41]
        },
        {
            "id":6, "arr":[65,34,31,56,53,78,93]
        }
    ]
}
  • 1
    Does this answer your question? [How to read an external local JSON file in JavaScript?](https://stackoverflow.com/questions/19706046/how-to-read-an-external-local-json-file-in-javascript) – Harun Yilmaz May 31 '20 at 06:48
  • In most of the cases, if you can access the file (for example: https://yoursite.com/your-json.json), you can use `fetch` to read its content. – Mosh Feu May 31 '20 at 09:30

0 Answers0