I am importing data from json like this
import data from './data.json'
where data.json looks a bit like this
{ "data": [ {"title": "Some title", "text": "Some text"}, {"title": "Some title", "text": "Some text"}, {"title": "Some title", "text": "Some text"} ] }
therefore, to use it in my file, I usually did something like data.data[0].title , which, in my opinion, is not the cleanest way, ideally I would like to use it as data[0].title , is there a way that I can include or edit my json file to achieve this?
source share