android - how to remove hidden junk character after php json encode


I was created JSON array fromjson_encode using PHP. I gave my array tojson_encode . It's created JSON array very well. And i feed this JSON array to my android apps. When i am gonna read this url at android it's return following EXCEPTION ERROR.

Error parsing data org.json.JSONException: Value  of type java.lang.String cannot be converted to JSONObject

But when i am gonna create jason object at android adding this following line

jObj=new JSONObject(json.substring(json.indexOf("{"), json.lastIndexOf("}") + 1));

It's working perfectly.

But i don't want to need the my second type solution. I need the php solution when i am put my json_encode on php.

And also at IOS the JSON return NULL values. How can i fix in both IOS and Android

Thanks advance

People are also looking for solutions to the problem: sha256 - Generate HMAC Signature on PHP


Didn't find the answer?

Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.

Ask a Question

Write quick answer

Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.

Similar questions

Find the answer in similar questions on our website.