How to remove hidden spam character after php json encoding

I created a JSON array from json_encodeusing PHP. I passed my array json_encode. He created a JSON array very well. And I am passing this JSON array to my Android apps. When I read this url on android, it will return after EXCEPTION ERROR.

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

But when I create jason object in android by adding the following line

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

It works great.

But I do not want to need my solution of the second type. I need a php solution when I put json_encode on php.

And also in IOS JSON return NULL values. How can I fix both in iOS and Android

thanks in advance

+4
source share
1

java.text.Normalizer : .

normalize CharSequence "", ASCII String.

+1

Source: https://habr.com/ru/post/1523679/


All Articles