我正在尝试从android解析json,但我得到了这个奇怪的异常.我的json数据是
{"id":"1","owner":"1","name":"gravitas","description":"is fest","start_time":"0000-00-00 00:00:00 ","end_time":"0000-00-00 00:00:00","场地":"vellore","radius":"10","lat":"11","lng":"11" "类型": "类型", "OWNERNAME": "迪利普", "noofpolls":0 "noofquizes":0 "peopleattending":0 "结果是":真}
在android我做
JSONObject j =new JSONObject(response);
Event pst = gson.fromJson(j.toString(), Event.class);
Run Code Online (Sandbox Code Playgroud)
我明白了:
org.json.JSONException: end of input at character 0 of
Run Code Online (Sandbox Code Playgroud)
它出什么问题了?这是代码......
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 …Run Code Online (Sandbox Code Playgroud) 有没有什么方法可以让日期时间格式像' YYYY-MM-DD HH:MM:SS'作为日期时间格式存储在mysql中,从android日期格式' MM-DD-YY'和格式时间' HH:MM'
输入: android date' MM-DD-YY'和android time' HH:MM'
输出: mysql datetime' YYYY-MM-DD HH:MM:SS'