使用齐射

时间:2015-12-18 17:48:18

标签: android json android-volley jsonobject

我正在从数据库中读取一些作为json对象的信息。 数据库返回格式良好的字符串(作为json对象)。 当我尝试将字符串转换为jsonObject时,它返回null

这是来自数据库的字符串:

{"items":[{"title":"Police","icon":"police","type":"normal","tel":"999"},{"title":"Ambulance","icon":"ambulance","type":"normal","tel":"976"},{"title":"Electricity","icon":"electricity","type":"normal","tel":"4848"},{"title":"Fire Station","icon":"fire","type":"normal","tel":"998"},{"title":"Airport Information 1","icon":"airport","type":"normal","tel":"0183447405"},{"title":"Airport Information 2","icon":"airport","type":"normal","tel":"0183780129"},{"title":"Water","icon":"water","type":"normal","tel":"3131"}],"success":1}

这里是logcat的响应错误:

12-18 20:24:44.529: W/System.err(25062): org.json.JSONException: Value  of type java.lang.String cannot be converted to JSONObject

你可以看到它表明字符串值是空的......而logcat显示我的字符串......

请注意,此代码之前的效果非常好..

编辑: 我尝试使用相同的代码从不同的数据库中读取。它运作良好 我想它的数据库错误。

0 个答案:

没有答案