---
title: "Json解析异常Value \ufeffof type java.lang.String cannot be converted to JSONObject"
author: "2528"
date: "2014-05-13T11:20:50Z"
tags: []
categories: ["移动开发"]
slug: "json-value-of-type-java-lang-string-cannot-be-converted-to-jsonobject"
draft: false
lastmod: "2014-10-31T15:31:19Z"
id: 2065711
url: "https://2528.iteye.com/blog/2065711"
---

今天解析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就没有问题了