Answer the question
In order to leave comments, you need to log in
How to correctly read the JSON file so that it is possible to output country and id?
JSON
file
[
{
"id": 833,
"name": "Ḩeşār-e Sefīd",
"state": "",
"country": "IR",
"coord": {
"lon": 47.159401,
"lat": 34.330502
}
},
{
"id": 2960,
"name": "‘Ayn Ḩalāqīm",
"state": "",
"country": "SY",
"coord": {
"lon": 36.321911,
"lat": 34.940079
}
},
{
"id": 3245,
"name": "Taglag",
"state": "",
"country": "IR",
"coord": {
"lon": 44.98333,
"lat": 38.450001
}
}
]
let test = JSON.parse('js/test.json');
console.log(test);
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question