165
rated 0 times
[
172]
[
7]
/ answers: 1 / hits: 143787
/ 8 Years ago, mon, june 6, 2016, 12:00:00
How can I parse through a JSON file retrieving all its data and using it in my code?
I've tried importing the file and just tried console logging it, but all it does is print Object {}:
import jsonData from ./file.json;
console.log(jsonData);
This is what my file.json looks like:
[
{
id: 1,
gender: Female,
first_name: Helen,
last_name: Nguyen,
email: [email protected],
ip_address: 227.211.25.18
}, {
id: 2,
gender: Male,
first_name: Carlos,
last_name: Fowler,
email: [email protected],
ip_address: 214.248.201.11
}
]
I'd want to be able to access the first and last name of each component and print those on the website.
More From » json