Store JSON Data in local Storage (Java Script)

Store JSON Data in local Storage (Java Script)

 
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!

 

Previous [ubuntu] network UNCLAIMED - Ubuntu 18.04 - Qualcomm Atheros AR93XX
Next [other] How to install email encryption using chrome
 

About author

You might also like

Ubuntu Dsicussions 0 Comments

[xubuntu] Smart phone will only connect for calls & audio with Bluetooth

I am using a Dell XPS-13-9300 duel booted with Windows 10 and a Samsung Galaxy S8 smart phone. Today I was able to send files from the laptop via bluetooth

Ubuntu Dsicussions 0 Comments

[ubuntu] Sigil 1.3 Installation

Hello I want to install this file sigil_1.3.0+dfsg-1.debian.tar.xz Can someone please tell me step by step how to install this. Thanks in advance for your help. Best Regards Kalyan  

Ubuntu Dsicussions 0 Comments

[ubuntu] Display got distorted in HP Pavilion 15

Ubuntu Version – 20.04 LTS Laptop Maker – HP Laptop version – pavilion 15 ec-0062ax Cpu – Ryzen 5 3550H with vega 8 graphics Gpu – Geforce GTX 1050 3GB

0 Comments

No Comments Yet!

You can be first to comment this post!

Leave a Reply