我正在尝试从android解析json,但出现了这个奇怪的异常。我的json数据是
{“ id”:“ 1”,“ owner”:“ 1”,“ name”:“ gravitas”,“ description”:“ is a fest”,“ start_time”:“ 0000-00-00 00:00:00 “,” end_time“:” 0000-00-00 00:00:00“,” venue“:” vellore“,” radius“:” 10“,” lat“:” 11“,” lng“:” 11“ ,“ type”:“ type”,“所有者名称”:“ dilip”,“ noofpolls”:0,“ noofquizes”:0,“人员参与”:0,“ result”:true}
在Android中
JSONObject j =new JSONObject(response);
Event pst = gson.fromJson(j.toString(), Event.class);
我得到:
org.json.JSONException: end of input at character 0 of
它出什么问题了?这是代码...
RestClient client = new RestClient("http://192.168.1.3/services/events/"+eve.getName());
try {
Log.i("MY INFO", "calling boston");
client.Execute(RequestMethod.POST);
} catch (Exception e) {
e.printStackTrace();
}
String response = client.getResponse();
Log.i("MY INFO", response);
GsonBuilder gsonb = new GsonBuilder();
Gson gson = gsonb.create();
Event pst = null;
try {
JSONObject j =new JSONObject(response);
pst = gson.fromJson(j.toString(), Event.class);
} catch (JSONException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
斯蒂芬大帝
繁花如伊
弑天下
相关分类