title: Escape escape characters in spring boot
body: <p>Given a string, I want to replace all double slashes with one slash, and then all instances of <code>\n</code> with <code>-</code>. For instance, if I have this:</p>
  
  <pre><code>\\n\\nff
  </code></pre>
  
  <p>It should be converted to:</p>
  
  <pre><code>\n\nff
  </code></pre>
  
  <p>And then to:</p>
  
  <pre><code>--ff
  </code></pre>
  
  <hr>
  
  <p>I wrote this code:</p>
  
  <pre><code>shippingAddress = shippingAddress.replaceAll("\\\\n", "\n");
  </code></pre>
  
  <p>For example:</p>
  
  <pre><code>public static void main(String[] args) {
      System.out.println("xx");
      String x = "enterchar17\\n\\n\\nenterchar17enterchar17\\n\\n\\n\\nenterchar17";
      System.out.println(x);
      x.replaceAll("\\n","\n");
      System.out.println(x);
  }
  </code></pre>
  
  <p>This produces this output:</p>
  
  <pre><code> xx
  enterchar17\n\n\nenterchar17enterchar17\n\n\n\nenterchar17
  enterchar17\n\n\nenterchar17enterchar17\n\n\n\nenterchar17
  </code></pre>
  
  <p>so it did not change. I need to escape escape char because somehow spring boot sends 2 slashes. What can i do?</p>
  
  <p>i think JSON does think double as double. It doesn't get it escape?</p>
  
  <pre><code>"line1": "fasfsafasfsa\n\n\nff\n\tasas",
  </code></pre>
  
  <p>on postman, when i send request like this, \n is converted to "-"</p>
  
  <p>but in postman when i send with double, it  cantconvert.</p>
  
  <p>when i inspect to the page where i send request of string, i see this</p>
  
  <pre><code>line1
  :
  "enterchar17↵↵v↵↵enterchar17↵↵↵enterchar17"
  </code></pre>
  
  <p>on chromium</p>