Search code examples
javaandroidregexstringremoveall

how to remove escape slash from string in android


I have tried all possible solution but couldn't find any answers.

I have following string.

"{\"property_type\":[\"residential\"],\"status\":[\"active\"],\"category\":[\"sale\"],\"page_size\":8,\"cur_page\":1}"

This is response I am getting from json.

Please help me with this concern.


Solution

  • You may try this if you want to remove escape slash from android ....

    String receivedString = "{\"property_type\":[\"residential\"],\"status\":[\"active\"],\"category\":[\"sale\"],\"page_size\":8,\"cur_page\":1}";
    
        String changedString = receivedString.replaceAll("\"", "\"");
        Log.d("your_tag", changedString);
    

    Output will be like below :

    {"property_type":["residential"],"status":["active"],"category":["sale"],"page_size":8,"cur_page":1}