I'm currently working on a test app for android and need to parse the JSON test data.
The JSON looks like this:
{"id":1,"name":"Test Test","questions":[{"id":1,"test":1,"text":"Kannst du diese Frage beantworten?","answers":[{"id":1,"question":1,"text":"Ja, das ist richtig.","correct":1},{"id":2,"question":1,"text":"Diese Antwort ist falsch.","correct":0},{"id":3,"question":1,"text":"Diese hier ist ebenfalls nicht so ganz korrekt.","correct":0}]},{"id":2,"test":1,"text":"Diese Frage hier ist nicht korrekt.","answers":[{"id":4,"question":2,"text":"Ich glaube dir nicht, das hier ist eh richtig.","correct":1},{"id":5,"question":2,"text":"Diese Antwort ist falsch.","correct":0},{"id":6,"question":2,"text":"Diese hier ist ebenfalls nicht so ganz korrekt.","correct":0}]}]}
What I need is to extract the questions and its' child data.
What I tried is:
JSONObject jObject = new JSONObject(result);
String test = jObject.getJSONObject("id").getJSONArray("questions").toString();
And
String myString = jObject .getJSONObject("questions").getJSONObject("answers").getString("text");