I am trying to store data in the local Storage from my JSON file. But I am getting an empty array in the local Storage. File name is 'data' in the project. [ "friends": [
Store JSON Data in local Storage (Java Script)
3
I am trying to store data in the local Storage from my JSON file. But I am getting an empty array in the local Storage. File name is 'data' in the project.
[
"friends": [
{
"id": 0,
"name": "Daugherty Gould"
},
{
"id": 1,
"name": "Foley Carpenter"
},
{
"id": 2,
"name": "Brewer Vinson"
}
]
localStorage.setItem('firstName',data.friends.name );
I am not getting the right output with above code. How can I get all the names in localstorage.
Thank you in advance!
[
"friends": [
{
"id": 0,
"name": "Daugherty Gould"
},
{
"id": 1,
"name": "Foley Carpenter"
},
{
"id": 2,
"name": "Brewer Vinson"
}
]
localStorage.setItem('firstName',data.friends.name );
I am not getting the right output with above code. How can I get all the names in localstorage.
Thank you in advance!
- ltrain_riders
- [ 1 ] Thanks
- robertlook
- Rita456
- nahtasurbhi7
Next Topics on Trending Feed
-
3