object mapper conversion issue when string contains'\/' patterns

136 Views Asked by At

I have following type of token that as to be send as it is in request.

//token contains following value token = "ABCD/saljljlkljljljl";

class Token{ public String token;

    public String getToken() {
        return token;
    }

    public void setToken(String token) {
        this.token = token;
    }


}

when I try to convert it to string using object mapper class, it converts it as follows. ObjectMapper mapper = new ObjectMapper(); mapper.writeValueAsString(token)

{"token":"ABCD\/saljljlkljljljl"}

Note one more '\' added in front of '/' due to which my calls are failing.Don't no why its not reflecting even in stackoverflow reader pane also.

Please help out on this.

0

There are 0 best solutions below