0

Im unable to get complete JSON string, it doesn't show last three character if the string. Here is JSON String

{"status":"success","data":"Screenshot_2016-07-24-13-06-4120160726082711.pn 

JSON request

StringRequest stringRequest = new StringRequest(Request.Method.POST,
                url, new Response.Listener<String>() {

            @Override
            public void onResponse(String response) {
                try {
                    Utils.psLog("Server RESPONSE >> " + response);
                    JSONObject obj = new JSONObject(response);
                        }
                       catch {
                        }

Error log

07-26 13:57:11.556 8632-8632/com.directory D/TEAMPS: Server RESPONSE >> 


                                                                       {"status":"success","data":"Screenshot_2016-07-24-13-06-4120160726082711.pn
07-26 13:57:11.557 8632-8632/com.directory D/TEAMPS: JSON Exceptionorg.json.JSONException: Unterminated string at character 78 of 


                                                                       {"status":"success","data":"Screenshot_2016-07-24-13-06-4120160726082711.pn

1 Answer 1

1

You are getting that error because the JSON Object appears to be incomplete (according do your code snippet). If the string composing the JSON is incomplete, it will cause a JSON Parsing Exception

{"status":"success","data":"Screenshot_2016-07-24-13-06-4120160726082711.pn 

Should instead be :

{"status":"success","data":"Screenshot_2016-07-24-13-06-4120160726082711.png"}
Sign up to request clarification or add additional context in comments.

4 Comments

I know but all I get is this only, btw it should be: {"status":"success","data":"Screenshot_2016-07-24-13-06-4120160726082711.png"}
Correct. But after fixing the JSON, you still get the same problem?
hi @Ricardo, this incomplete string getting from server how can i resolve ?
Hello @amit . If that string is coming from the server, there is not much you can do on the application. You have to fix that string on the server or contact whoever serves that string.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.