Assume that content of "parent" is stored in reader variable, and inside it has a child object named "child". Which of the following statement we need to you to get this child object?

Given the following JSON content:
{"parent":[
{"child":"Peter"}
]}

Assume that content of "parent" is stored in reader variable, and inside it has a child object named "child". Which of the following statement we need to you to get this child object?



A. JSONObject childObj = reader.getJSONObject("child");
B. JSONObject childObj = parent.getJSONObject("child");
C. JSONObject childObj = (JSONObject) parent.getJSON("child");
D. JSONObiect childObi = (JSONObiect) reader.getJSON("child"):


Answer: A


Learn More :