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
Answer
Solution:
The
is intended to do exactly this: remove unwanted unicode characters.
The
method will allow you to pass your
CharSequence
and return the "normalized", ASCII-onlyString
.