Double slash in return value from controller

Why they're being added?

Because that's how you print a backslash in JSON. \ is a special character. It pairs with the next character(s) to define what it prints. For example, \n means to add a new line, not printing "\n". \\ means a print a single backslash.

The server (your code) and the client using your application will understand this escape sequence just fine.


These \ are not part of the string but only one i.e. \ is part of string. another \ is added as a escape character only.

if you print this you will only get single slash not double these are just representational value at the time of debug only.

Check live code : here

enter image description here

Escape Characters