If you want to read a json
file locally like this:
{
id:"1",
name:"taro"
},
{
id:"2",
name:"hanako"
},
Most people use jQuery’s $.getJSON()
to read it, but you can easily do it with just JavaScript.
Yes, you can use the Fetch API.
fetch('../index.json')
.then(response => response.json())
.then(data => console.log(data));