在我的應用程序中,我從HTTP Response獲取以下的json。
[{"Date":"2012-1-4T00:00:00","keywords":null,"NeededString":"this is the sample string I am needed for my project","others":"not needed"}]
我想從上面的json中獲得 "NeededString" ,如何實現呢?
String str="{"Date":"2012-1-4T00:00:00","keywords":null,"NeededString":"this is the sample string I am needed for my project","others":"not needed"}";
轉義不寫了,說下
JsonObject jobj=new JsonObject(str);
String needStr=jobj.getStrig("NeededString");