I have the following JSON object returned and I want to access all the "title" values. I have been able to get a new object of all the "pages," but not the "titles." I have tried everything except the correct thing! The "similar" questions on here are straight forward array access questions. This seems to involve nested arrays. Please help! Thanks.
{
"batchcomplete": "",
"continue": {
"gsroffset": 15,
"continue": "gsroffset||"
},
"query": {
"pages": {
"22989": {
"pageid": 22989,
"ns": 0,
"title": "Paris",
"index": 1
},
"59134": {
"pageid": 59134,
"ns": 0,
"title": "Paris Commune",
"index": 13
},
"61371": {
"pageid": 61371,
"ns": 0,
"title": "Paris (disambiguation)",
"index": 2
},
"64129": {
"pageid": 64129,
"ns": 0,
"title": "Catacombs of Paris",
"index": 11
},
"76286": {
"pageid": 76286,
"ns": 0,
"title": "Disneyland Paris",
"index": 15
},
"89106": {
"pageid": 89106,
"ns": 0,
"title": "Paris–Brest–Paris",
"index": 8
},
"357488": {
"pageid": 357488,
"ns": 0,
"title": "Paris Saint-Germain F.C.",
"index": 10
},
"868936": {
"pageid": 868936,
"ns": 0,
"title": "Paris Gun",
"index": 14
},
"2397134": {
"pageid": 2397134,
"ns": 0,
"title": "Paris (Paris Hilton album)",
"index": 6
},
"7618874": {
"pageid": 7618874,
"ns": 0,
"title": "Paris syndrome",
"index": 9
},
"11217925": {
"pageid": 11217925,
"ns": 0,
"title": "Paris Hilton",
"index": 7
},
"23528038": {
"pageid": 23528038,
"ns": 0,
"title": "Paris Jackson (actress)",
"index": 5
},
"30242372": {
"pageid": 30242372,
"ns": 0,
"title": "Paris Agreement",
"index": 4
},
"45259235": {
"pageid": 45259235,
"ns": 0,
"title": "Paris Laxmi",
"index": 12
},
"55340805": {
"pageid": 55340805,
"ns": 0,
"title": "Paris Paris",
"index": 3
}
}
}
}
It wants me to add more details, but I don't know what else I can add.
var obj = JSON.parse()to access the object and then examples how to access properties of it. How to access JSON encoded data of an array using javascriptpages, so we can help you to tweak it in order to gettitles.