码迷,mamicode.com
首页 >  
搜索关键字:jsonobject    ( 880个结果
关于json解析时异常org.json.JSONException: A JSONObject text must begin with '{' at character 1 of ?{的解决方法
出现这个异常的原因是json串格式不正常,没有"{"开始或没有"}"结尾,仔细检查下json文件的格式一般就可以解决这个问题。但是有时候json文件是正常的,仍然有这个异常信息,怎么办呢,这个是因为你的json文件头里带有编码字符(如UTF-8等),读取字符串时json串是正常的,但是解析就有异常,一般会出现这样的情况是读取的json串是来自于服务器或本地的文件,文件头里自带编码,就我碰到情况来看...
分类:Web程序   时间:2015-05-07 14:27:16    阅读次数:219
Java进阶(四)Java反射TypeToken解决泛型运行时类型擦除的问题解决
在开发时,遇到了下面这条语句,不懂,然习之。   private List listLottery = new ArrayList();   Gson gson=new Gson(); JSONObject object=new JSONObject(callbackValue);   listLottery =  gson.fromJson(object.getString("li...
分类:编程语言   时间:2015-05-06 17:45:43    阅读次数:219
使用simple json时遇到的一个小问题
使用simple json时遇到的一个小问题发现问题最近写了个程序,在构建http参数的时候使用到了org.json.simple.JSONObject这个类,上线之后有客户反馈说http参数格式不正确,如果参数中包含斜杠(/)则前面都会自动加上一个反斜杠()。调查问题发现问题之后首先去看了一下simple json的源代码,在他的源码中发现如下一段: public static void...
分类:Web程序   时间:2015-05-05 21:55:19    阅读次数:200
json、JSONObject、JSONArray的应用
type.javapackage jiekou.duixiang;import java.text.ParseException;import java.text.SimpleDateFormat;import java.util.Date;import util.Constant;public c...
分类:Web程序   时间:2015-05-05 19:02:28    阅读次数:153
ajax 回传参数
JSONObject json = new JSONObject(); json.put("msg", msg); json.put("success", count); json.put("error", count2); String jsonString=js...
分类:Web程序   时间:2015-04-28 17:55:48    阅读次数:153
Spring3.0 Could not find acceptable representation 解决方案
在使用spring3.0.5 mvc开发时,进行json接口数据开发,使用JSONObject.fromObject(object)返回json数据。遇到“org.springframework.web.HttpMediaTypeNotAcceptableException: Could not f...
分类:编程语言   时间:2015-04-28 17:34:39    阅读次数:927
如何限制listview的显示个数
如何限制供热gridview 和listview显示的个数;思路问题:加载两个,我只拿两条出来Log.i("查询结果", result);JSONObject jsonObject = new JSONObject(result);map.put("code", jsonObject.getStri...
分类:其他好文   时间:2015-04-28 01:40:45    阅读次数:130
手机号码归属地API
今天用到了查询手机号码归属地的这个功能,但是公司自己的字典库数据太过陈旧,每一百个号码就有五六个识别不出来,所以就找了开源的API,维护了一下字典库。用到的API有两个,整理如下:淘宝的JSONObject json = null; String url = "http://tcc.t...
分类:移动开发   时间:2015-04-25 14:54:15    阅读次数:146
android 解析JsonArray
import org.json.JSONArray; import org.json.JSONObject; //jsonData的数据格式:[{ "id": "27JpL~jd99w9nM01c000qc", "version": "abc" },{ "id": "27JpL~j6UGE0...
分类:移动开发   时间:2015-04-24 18:42:22    阅读次数:116
Android JSON: JSONArray cannot be converted to JSONObject
JSONArray 转换为 List>报错Android JSON: JSONArray cannot be converted to JSONObject原代码for (int i = 0; i < jsonArray.length(); i++) { JSONObject json...
分类:移动开发   时间:2015-04-24 12:19:13    阅读次数:215
880条   上一页 1 ... 69 70 71 72 73 ... 88 下一页
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!