here is a json tree from wikipedia. http://en.wikipedia.org/w/api.php?action=query&titles=japan&prop=categories&format=json
I met a trouble in "pages": { "15573": {. If I will turn the query word, the page number is always changed. How to do a json decode when a child nod is a radom number? Thanks.
{
"query": {
"normalized": [
{
"from": "japan",
"to": "Japan"
}
],
"pages": {
"15573": {
"pageid": 15573,
"ns": 0,
"title": "Japan",
"categories": [
{
"ns": 14,
"title": "Category:All articles containing potentially dated statements"
},
{
"ns": 14,
"title": "Category:Article Feedback Pilot"
},
{
"ns": 14,
"title": "Category:Articles containing Japanese language text"
},
{
"ns": 14,
"title": "Category:Articles containing potentially dated statements from 2010"
},
{
"ns": 14,
"title": "Category:Articles containing potentially dated statements from January 2011"
},
{
"ns": 14,
"title": "Category:Constitutional monarchies"
},
{
"ns": 14,
"title": "Category:Countries bordering the Pacific Ocean"
},
{
"ns": 14,
"title": "Category:Countries bordering the Philippine Sea"
},
{
"ns": 14,
"title": "Category:East Asian countries"
},
{
"ns": 14,
"title": "Category:Empires"
}
]
}
}
},
"query-continue": {
"categories": {
"clcontinue": "15573|Featured articles"
}
}
}
You can do this (based on what you want in comment):
I’m assuming you want to access it as array, but you can also do it with the default return value, with little modification of course.