Android org.json.JSONException:Value<;无法将java.lang.String类型的转换为JSONObject

Android org.json.JSONException:Value<;无法将java.lang.String类型的转换为JSONObject,android,Android,我有这段代码并尝试运行,但它给了我一个异常“org.json.JSONException:Value

我有这段代码并尝试运行,但它给了我一个异常“org.json.JSONException:Value<类型java.lang.String不能转换为JSONObject”。任何帮助都将被通知

代码:

private class MyTask extends AsyncTask<String, Integer, String> {

            @Override
            protected void onPostExecute(String result) {

                CreateAndAppendListLayout();

                super.onPostExecute(result);
            }

            @Override
            protected void onPreExecute() {
                // TODO Auto-generated method stub




                super.onPreExecute();
            }

            @Override
            protected void onProgressUpdate(Integer... values) {
                // TODO Auto-generated method stub
                super.onProgressUpdate(values);

            }

            @Override
            protected String doInBackground(String... params) {


                String myRespone = null;
                String url = params[0];
                HttpClient client = new DefaultHttpClient();

                HttpGet Get = new HttpGet(url);

                try {
                    HttpResponse response = client.execute(Get);

                    HttpEntity entity = response.getEntity();
                    myRespone = EntityUtils.toString(entity);

                } catch (ClientProtocolException e) {

                    e.printStackTrace();

                    Log.e("My webservice Response", "ClientProtocolException");

                } catch (IOException e) {

                    Log.e("My webservice Response", "IOException");

                    e.printStackTrace();
                }
                JSONObject jsonObj;

                if (myRespone != null) {
                    try {



                        jsonObj = new JSONObject(myRespone);
                        JSONArray jsonArray = jsonObj.getJSONArray("Results");


                        for (int i = 0; i <= jsonArray.length() - 1; i++) {
                            myList.add(jsonArray.getJSONObject(i));

                        }



                    } catch (Exception e) {
                        e.printStackTrace();
                    }
                } else {
                    // do nothing
                }
                return null;
            }

        }
07-30 11:15:24.570: W/System.err(8247): org.json.JSONException: Value < of type java.lang.String cannot be converted to JSONObject
07-30 11:15:24.570: W/System.err(8247):     at org.json.JSON.typeMismatch(JSON.java:111)
07-30 11:15:24.570: W/System.err(8247):     at org.json.JSONObject.<init>(JSONObject.java:158)
07-30 11:15:24.570: W/System.err(8247):     at org.json.JSONObject.<init>(JSONObject.java:171)
07-30 11:15:24.570: W/System.err(8247):     at com.example.myclass$MyTask.doInBackground(User_Reviews.java:484)
07-30 11:15:24.570: W/System.err(8247):     at com.example.myclass$MyTask.doInBackground(User_Reviews.java:1)
07-30 11:15:24.570: W/System.err(8247):     at android.os.AsyncTask$2.call(AsyncTask.java:287)
07-30 11:15:24.570: W/System.err(8247):     at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:305)
07-30 11:15:24.570: W/System.err(8247):     at java.util.concurrent.FutureTask.run(FutureTask.java:137)
07-30 11:15:24.575: W/System.err(8247):     at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:230)
07-30 11:15:24.575: W/System.err(8247):     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076)
07-30 11:15:24.575: W/System.err(8247):     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569)
07-30 11:15:24.575: W/System.err(8247):     at java.lang.Thread.run(Thread.java:856)
LOGCAT:

private class MyTask extends AsyncTask<String, Integer, String> {

            @Override
            protected void onPostExecute(String result) {

                CreateAndAppendListLayout();

                super.onPostExecute(result);
            }

            @Override
            protected void onPreExecute() {
                // TODO Auto-generated method stub




                super.onPreExecute();
            }

            @Override
            protected void onProgressUpdate(Integer... values) {
                // TODO Auto-generated method stub
                super.onProgressUpdate(values);

            }

            @Override
            protected String doInBackground(String... params) {


                String myRespone = null;
                String url = params[0];
                HttpClient client = new DefaultHttpClient();

                HttpGet Get = new HttpGet(url);

                try {
                    HttpResponse response = client.execute(Get);

                    HttpEntity entity = response.getEntity();
                    myRespone = EntityUtils.toString(entity);

                } catch (ClientProtocolException e) {

                    e.printStackTrace();

                    Log.e("My webservice Response", "ClientProtocolException");

                } catch (IOException e) {

                    Log.e("My webservice Response", "IOException");

                    e.printStackTrace();
                }
                JSONObject jsonObj;

                if (myRespone != null) {
                    try {



                        jsonObj = new JSONObject(myRespone);
                        JSONArray jsonArray = jsonObj.getJSONArray("Results");


                        for (int i = 0; i <= jsonArray.length() - 1; i++) {
                            myList.add(jsonArray.getJSONObject(i));

                        }



                    } catch (Exception e) {
                        e.printStackTrace();
                    }
                } else {
                    // do nothing
                }
                return null;
            }

        }
07-30 11:15:24.570: W/System.err(8247): org.json.JSONException: Value < of type java.lang.String cannot be converted to JSONObject
07-30 11:15:24.570: W/System.err(8247):     at org.json.JSON.typeMismatch(JSON.java:111)
07-30 11:15:24.570: W/System.err(8247):     at org.json.JSONObject.<init>(JSONObject.java:158)
07-30 11:15:24.570: W/System.err(8247):     at org.json.JSONObject.<init>(JSONObject.java:171)
07-30 11:15:24.570: W/System.err(8247):     at com.example.myclass$MyTask.doInBackground(User_Reviews.java:484)
07-30 11:15:24.570: W/System.err(8247):     at com.example.myclass$MyTask.doInBackground(User_Reviews.java:1)
07-30 11:15:24.570: W/System.err(8247):     at android.os.AsyncTask$2.call(AsyncTask.java:287)
07-30 11:15:24.570: W/System.err(8247):     at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:305)
07-30 11:15:24.570: W/System.err(8247):     at java.util.concurrent.FutureTask.run(FutureTask.java:137)
07-30 11:15:24.575: W/System.err(8247):     at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:230)
07-30 11:15:24.575: W/System.err(8247):     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076)
07-30 11:15:24.575: W/System.err(8247):     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569)
07-30 11:15:24.575: W/System.err(8247):     at java.lang.Thread.run(Thread.java:856)
java.lang.String类型的
07-30 11:15:24.570:W/System.err(8247):org.json.JSONException:Value<无法转换为JSONObject
07-30 11:15:24.570:W/System.err(8247):位于org.json.json.typemissmatch(json.java:111)
07-30 11:15:24.570:W/System.err(8247):位于org.json.JSONObject.(JSONObject.java:158)
07-30 11:15:24.570:W/System.err(8247):位于org.json.JSONObject.(JSONObject.java:171)
07-30 11:15:24.570:W/System.err(8247):在com.example.myclass$MyTask.doInBackground(User_Reviews.java:484)
07-30 11:15:24.570:W/System.err(8247):在com.example.myclass$MyTask.doInBackground(User_Reviews.java:1)
07-30 11:15:24.570:W/System.err(8247):在android.os.AsyncTask$2.call(AsyncTask.java:287)
07-30 11:15:24.570:W/System.err(8247):位于java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:305)
07-30 11:15:24.570:W/System.err(8247):位于java.util.concurrent.FutureTask.run(FutureTask.java:137)
07-30 11:15:24.575:W/System.err(8247):在android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:230)
07-30 11:15:24.575:W/System.err(8247):位于java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076)
07-30 11:15:24.575:W/System.err(8247):位于java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569)
07-30 11:15:24.575:W/System.err(8247):位于java.lang.Thread.run(Thread.java:856)

您试图解析的JSON字符串可能无效。它有一些
原始HTML(
,这意味着它要么生成得不好,要么PHP正在插入
错误/警告
并销毁字符串

请检查服务响应代码,只有当它是200时才解析JSON,否则可能是错误的。
在您的情况下,它正在发送HTML代码,因此正在崩溃

只需检查字符串是否有任何未显示的特殊字符等…您的JSON数据非常简单。我确信它包含特殊字符。请检查JSON数据的有效性。使用此链接