String cannot be converted to JSONArray

為{幸葍}努か 提交于 2019-12-02 11:19:39

I found what was wrong with JSON. I found at the beginning a character "?" added somewhere in the code and it was not visible until I stored the logCat entry to a file. So I added the code line and it works fine now.

result = result.substring(1);

I hope it may help someone in the future thanx to Waqas

Put this lines:

        while(result.charAt(0)!='[')  //or result.charAt(0)!='{'
        {
            result = result.substring(1);
            Log.d("Tag1", "remove 1st char");

        }

after:

        result = sb.toString();

To become like this:;

        result = sb.toString();

        while(result.charAt(0)!='[')
        {
            result = result.substring(1);
            Log.d("Tag1", "remove 1st char");

        }
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!