尝试解析java for android中的数据时出现Json错误

时间:2014-02-15 11:42:30

标签: java android json

我遇到通过json解析数据的问题我不断收到此错误消息。我的程序昨天工作正常,但今天我继续收到此错误消息。

02-15 06:09:28.112: E/JSON Parser(1130): Error parsing data org.json.JSONException: Expected ':' after main at character 6 of {main}(  )</td><td title='C:\wamp\www\android_connect\selectUser.php' bgcolor='#eeeeec'>..\selectUser.php<b>:</b>0</td></tr>
02-15 06:09:28.112: E/JSON Parser(1130): </table></font>
02-15 06:09:28.112: E/JSON Parser(1130): <br />
02-15 06:09:28.112: E/JSON Parser(1130): <font size='1'><table class='xdebug-error xe-notice' dir='ltr' border='1' cellspacing='0' cellpadding='1'>
02-15 06:09:28.112: E/JSON Parser(1130): <tr><th align='left' bgcolor='#f57900' colspan="5"><span style='background-color: #cc0000; color: #fce94f; font-size: x-large;'>( ! )</span> Notice: Undefined index: password in C:\wamp\www\android_connect\selectUser.php on line <i>18</i></th></tr>
02-15 06:09:28.112: E/JSON Parser(1130): <tr><th align='left' bgcolor='#e9b96e' colspan='5'>Call Stack</th></tr>
02-15 06:09:28.112: E/JSON Parser(1130): <tr><th align='center' bgcolor='#eeeeec'>#</th><th align='left' bgcolor='#eeeeec'>Time</th><th align='left' bgcolor='#eeeeec'>Memory</th><th align='left' bgcolor='#eeeeec'>Function</th><th align='left' bgcolor='#eeeeec'>Location</th></tr>
02-15 06:09:28.112: E/JSON Parser(1130): <tr><td bgcolor='#eeeeec' align='center'>1</td><td bgcolor='#eeeeec' align='center'>0.0030</td><td bgcolor='#eeeeec' align='right'>252360</td><td bgcolor='#eeeeec'>{main}(  )</td><td title='C:\wamp\www\android_connect\selectUser.php' bgcolor='#eeeeec'>..\selectUser.php<b>:</b>0</td></tr>
02-15 06:09:28.112: E/JSON Parser(1130): </table></font>


    }

我正在尝试登录,这将允许用户基于'type',即admin或normal。获得访问不同的gui。我的节目昨天工作正常,但今天该节目似乎被打破了。

1 个答案:

答案 0 :(得分:1)

从您的logcat输出看起来,源URL不再返回正确的JSON。可能是URL的格式已更改,或API已更改。

我认为这里有两件事需要解决:

  1. 查找文档以对您的请求进行必要的更改。

  2. 让应用程序更优雅地处理错误,而不仅仅是崩溃。我认为您应该检查HTTP响应代码以及JSON解析错误。

相关问题