W / System.err(421):org.json.JSONException:字符0的输入结束

时间:2013-04-02 03:34:32

标签: android

this code error:
04-02 03:01:52.552: I/params(421): [name=aad, category_id=0]
04-02 03:01:52.552: E/Log(421): Failed to download result..
04-02 03:01:52.552: W/System.err(421): org.json.JSONException: End of input at character 0 of 
04-02 03:01:52.552: W/System.err(421):  at org.json.JSONTokener.syntaxError(JSONTokener.java:446)
04-02 03:01:52.562: W/System.err(421):  at org.json.JSONTokener.nextValue(JSONTokener.java:93)
04-02 03:01:52.562: W/System.err(421):  at org.json.JSONObject.<init>(JSONObject.java:154)
04-02 03:01:52.562: W/System.err(421):  at org.json.JSONObject.<init>(JSONObject.java:171)
04-02 03:01:52.562: W/System.err(421):  at com.gift2u.products.ListProduct.onCreate(ListProduct.java:94

如果我给params [name =,category_id = 0]所有编程运行正确 我编写程序搜索过滤器product_name或category_id。 谢谢大家的回答

1 个答案:

答案 0 :(得分:1)

您的Json字符串格式错误。

将[...]替换为{...}。

[]是一个json数组,而不是json对象。