The answer from the server sometimes comes wrong, for example sometimes "null" or "\ t null"

So, I tried to solve this way

JSON_STRING - server response

  try { _gson.fromJson(JSON_STRING, Object.class); return true; } catch (com.google.gson.JsonSyntaxException ex) { return false; } 

And so

 if (JSON_STRING.trim().length() < 10){ JSON_STRING = JSON_STRING.replaceAll(" ", ""); } 

But still the answer is validation passes, how do I remove spaces and tabs?

    1 answer 1

     JSON_STRING = JSON_STRING.replace("\t", "").trim();