我想从这种类型的json获得学校名称:
"username": "blah",
"education": [
{
"school": {
"id": "[removed]",
"name": "[removed]"
},
"year": {
"id": "[removed]",
"name": "[removed]"
},
"type": "High School"
},
{
"school": {
"id": "[removed]",
"name": "[removed]"
},
"year": {
"id": "[removed]",
"name": "[removed]"
},
"type": "College"
}
]
这是我的代码:
JSONObject obj=null;
URL img_url;
String jsonUser = facebook.request("me");
obj=Util.parseJson(jsonUser);
String id=obj.optString("id");
String name=obj.optString("name");
我应该写什么代码来获得教育领域的学校名称?
答案 0 :(得分:1)
Facebook fb = new Facebook(API_KEY);// ... login user here ...JSONObject me = new JSONObject(fb.request("me")); String id = me.getString("id");
答案 1 :(得分:0)
你可以尝试
var schoolname = yourobject.education.school.name