字符串如下
[{postUser:自由的翅膀,content:please,where do you find this picture?,dateTime:2016-12-14 12:29:286}]
把这字符串转jsonarray的时候就会抱错
JSONArray array=new JSONArray(str);
报错:
org.json.JSONException: Expected a ':' after a key at character 64
我看不出这字符串的json格式哪里有问题,而且我生成这字符串也是用jsonobject,jsonarray来生成然后再toString()的,求指点
where do you find this picture? where do you find this picture? 这里你不是按json的格式来的
你要“where do you find this picture?:’‘ ”格式要配上啊
参考格式:{ "people": [
{ "firstName": "Brett", "lastName":"McLaughlin", "email": "aaaa" },
{ "firstName": "Jason", "lastName":"Hunter", "email": "bbbb"},
{ "firstName": "Elliotte", "lastName":"Harold", "email": "cccc" }
]}
http://blog.csdn.net/taxiangwuhen/article/details/7849711
http://www.bkjia.com/Javabc/1017059.html
改成下面这样:
[{"postUser":"自由的翅膀","content":"please,where do you find this picture?","dateTime":"2016-12-14 12:29:286"}]
检查或者格式化,可以用上面那个地址。
这不是json字符格式,所以报错