I am trying to read a JSON data : and i got this error Element implicitly has an 'any' type because expression of type 'string' can't be used to the index type my data is local josn file and I am importing them :
{
"user": {
"name": "foo",
"location": "India",
},
"product": {
"name": "Iphone",
"version": "12",
}
}
i am displaying like this
const data =data;
<div>
{Object.keys(data.user).map((key,i) => (
<p key={i}>
<span>{key}</span>
<span>{data.user[key]}</span>
</p>))}
</div>
every thing is working except for this line :
<span>{data.user[key]}</span>
it gives error :
Element implicitly has an 'any' type because expression of type 'string' can't be used to the index type
No index signature with a parameter of type 'string' was found on type