'ansible duplicates slashes in windows file path

Trying to test simple ansible script I defined a variable.

variable: C:\Log\1.txt

Next I simply try to echo this variable.

-name: echo
  debug: msg="{{ variable }}"

Got:

 "msg": "C:\\Log\\1.txt"

Expected output:

"msg": "C:\Log\1.txt"

How can I get one slash in path output?

Thanks.



Solution 1:[1]

Don't be confused by the fact that ansible-playbook prints debug messages in JSON encoded form, so some characters are escaped.
There's no duplicated slashes in the variable's value.

See my answer for different question for details: https://stackoverflow.com/a/39587120/2795592

Solution 2:[2]

There is no confusion. MYDOMAIN\\myUser is just plain stupid in output a lot of the time. There are persons who are not propeller heads looking at the output and to them it is simply garbage.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Community
Solution 2 Kym