Removing “\” in json object string

后端 未结 1 2007
天命终不由人
天命终不由人 2021-01-24 07:15

How can i remove special character \"\\\" in the string below:

String x = {
    \"message\": {
        \"@content\": \"toom\"
    },
    \"recipients\": \"[{\\\"         


        
相关标签:
1条回答
  • 2021-01-24 08:08

    You must escape the backslash in the regex.

    try

    x.replaceAll("\\\\", "")
    

    see JavaRegularExpressions: 3.6. Backslashes in Java

    0 讨论(0)
提交回复
热议问题