How to escape new line character?

"MethodParameter" => "{\r\n  \"getCardholderBalance\": {\r\n    \"acquirer\": {\r\n      
\"id\": \"testdemo\",\r\n      \"userId\": \"xxxxx\",\r\n      \"password\": 
\"xxxxxxxxxxxxxxx\"\r\n    },\r\n    \"card\": {\r\n      \"number\": 
\"5559590230901005\",\r\n      \"referenceId\": \"394849349098\"\r\n    },\r\n    
\"description\": \"YES\",\r\n    \"includeSupplementaryCards\": \"Y\",\r\n    
\"sendClearCard\": \"Y\",\r\n    \"applyFee\": \"N\",\r\n    \"isForcedPost\": \"Y\"\r\n  }\r\n}"

I want to escape \r\n and \ in the above string. Can you please help me how I can do this task?

        gsub => ["MethodParameter", "\\r\\n ", ""]

I have tried this but it doing nothing.

Issue Resolved.

        gsub => ["MethodParameter", "[\r\n  ]", ""]
        gsub => ["MethodParameter", '\"', "'"]

Thanks for the solution.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.