`

Json解析异常Value of type java.lang.String cannot be converted to JSONObject

阅读更多

今天解析json遇到 org.json.JSONException: Value of type java.lang.String cannot be converted to JSONArray

在4.0版本没有问题,但在2.3.7版本就遇到这问题很奇怪,我的josn是用ultraEdit文本编辑器保存为UTF-8的,但还是报这错误,后来查到了:

 

 该异常有 json 文件编码所引起的,所以切切不要应用 记事本 编辑 json 文件,而应选择其他文本编辑器,如 EditPlus ,并重视保存编码格局为 UTF-8,不然可能产生中文乱码。

 

 用记事本编辑后,即使 另存为 UTF-8 情势,也会产生乱码,因为保存在为 UTF-8 + BOM 编码

 

 

后来用EditPlus保存为UTF-8就没有问题了

分享到:
评论

相关推荐

    解决litjson 中JsonData.ToJson()中文转码问题

    从服务端收到的json中有中文 然后JsonData jd = JsonMapper.ToObject(strJson); json中如有中文 会出现\uXXXX\uXXXX等 我改了下 上传了能解决此问题的litjson版本

    java实现排序算法

    java实现七种排序算法

    json.js_json2.js

    // be converted to Date objects. myData = JSON.parse(text, function (key, value) { var a; if (typeof value === 'string') { a = /^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2}(?:\.\d*)?)Z$/.exec...

    uipath level 1 lesson 3参考答案.docx

    3. How can a string variable called myString be converted to an all-capitals representation for future use? 4. Which activity can be used to loop through each row from a DataTable? 5. What key ...

    JSP Simple Examples

    and one of the feature of OOP in java is that, we can assign a subclass object or variable to the variable of the superclass type. Log files Log files keeps a records of internet protocol addresses...

    数据库工具类DatabaseUtil.java

    java.lang.reflect.Method method = clazz.getMethod("close", null); method.invoke(resource, null); } catch (Exception e) { // e.printStackTrace(); } } /** * 执行 SELECT 等 SQL 语句并返回结果集. ...

    C# to Java 代码转换工具

    Folder conversion: Entire folders of C# code files are converted to Java code files.(文件夹转换) 2. Code snippet and file conversion: Our snippet conversion accuracy is outstanding and does not ...

    linqer_4.6.0.0_trial.exe

    Not every SQL statement can be converted to LINQ, but Linqer covers many different types of SQL expressions. Linqer supports both .NET languages - C# and Visual Basic. Because LINQ is a part of the ...

    TypeError: only integer tensors of a single element can be converted to an index

    在调整loss计算的时候遇到了TypeError: only integer tensors of a single element can be converted to an index这个问题,原来的计算公式为: self.loss_D = (self.loss_D_fake + self.loss_D_real) * 0.5 调整后...

    A tiny JSON library for C++11.

    There are also implicit constructors that allow standard and user-defined types to be automatically converted to JSON. For example: class Point { public: int x; int y; Point (int x, int y) : x(x),...

    DWR,web.xml,dwr.xml,converted,created

    DWR初学者专题,有详细笔记。 DWR很轻松就学会。 取得dwr的dwr.jar包和其他dwr所需的其他jar包 web.xml ...如果远程Bean A有个方法A.blah(B),那么你需要为A建立一个created,为B建立一个converted.。。

    Android:Field can be converted to a local varible.的解决办法

    Android:Field can be converted to a local varible.的解决办法 前言: 使用 Android Studio 开发 Android 有一段时间了,偶尔会碰到 AS 在一些私有变量上有黄色高亮提示Field can be converted to a local ...

    Android代码-GetJSON

    It Gives data as a String which can be used to pass the data between activities which can then be converted to JsonObject to carry on further operations. It can also return data in JsonObject. It ...

    FlexGraphics_V_1.79_D4-XE10.2_Downloadly.ir

    - FIX: The value of some string flex-properties that began with a parenthese or curly bracket had no apostrophe at the end; that caused an error when reading. (fixed TPropList.SavePropValue for the ...

    Google C++ Style Guide(Google C++编程规范)高清PDF

    The definition of an inline function needs to be in a header file, so that the compiler has the definition available for inlining at the call sites. However, implementation code properly belongs in ....

    LuaUnicode icu-lua

    If you want to use the Unicode notion of string equality, or use Unicode strings as table keys, and you cannot guarantee that your strings are normalized, then you'll have to write or find a ...

    Shogun 3.0

    Gaussian and Sigmoid Kernel but also comes with a number of recent string kernels as e.g. the Locality Improved [4], Fischer [5], TOP [6], Spectrum [7], Weighted Degree Kernel (with shifts) [8, 9, 10]...

    xnb exporter

    XNB EXPORTER Version: 1.0 4th of June 2011 ...4. The selected .XNB files will now be converted to .PNG images and saved in the same folder with the original files with the same names.

    uipath-Level 1最终测试答案.docx

    12. How can a string variable called myString be converted to an all-capitals representation for future use? 13. When should you use the Flowchart workflow? 14. How can you trigger another workflow ...

Global site tag (gtag.js) - Google Analytics