Im пытается разобрать информацию из Википедии. Но у меня проблема. Я не получаю ошибки от try catch, но строка, которую я хочу, равна null. я фактически получил весь JSon, но есть проблемы, разделив их здесь является JSON:Weird JSON Разбор объектов
{
"batchcomplete": "",
"query": {
"pages": {
"280636": {
"pageid": 280636,
"ns": 0,
"title": "Gary Moore",
"extract": "Robert William Gary Moore (4 April 1952 – 6 February 2011) was a Northern Irish musician, most widely recognised as a singer and virtuoso guitarist.\nIn a career dating back to the 1960s, Moore played with musicians including Phil Lynott and Brian Downey during his teens, leading him to memberships with the Irish bands Skid Row and Thin Lizzy, and British Band Colosseum II. Moore shared the stage with such blues and rock musicians as B.B. King, Albert King, Jack Bruce, Albert Collins, George Harrison, and Greg Lake, as well as having a successful solo career. He guested on a number of albums recorded by high-profile musicians."
}
}
}
}
Мой код, чтобы получить «извлечь» информацию:
try {
JSONObject object = new JSONObject(result); // result is the String with the whole Json
String desc = object.getString("extract"); //this is going to be null
} catch (JSONException e) {
Log.e("JSONException", "Error: " + e.toString());
}
Im новичку форматами JSON, пожалуйста, помогите! Являются ли эти двойные объекты JSON?
Спасибо, но Input obj3 меняется другими поисками. Как я могу это сделать? fx 280636 to 203442 –
'obj3 = obj2.getJSONObject (obj2.getNames() [0])' –
Но теперь стоит «Метод getNames() не определен для типа JSONObject». Что не так ? Я уже импортировал «import org.json. *;» Но это не помогло –