You don’t actually have one backslash in the original string. See:
iex(9)> body = %{password: "my\Password"}
%{password: "myPassword"}
Notice how the output is just "myPassword". The backslash is gone there, it doesn’t have anything to do with Poison’s JSON encoding. \ is itself the escape character in a string. If you want one in there literally, you need to escape it:
iex(1)> IO.puts("my\Password")
myPassword
:ok
iex(2)> IO.puts("my\\Password")
my\Password
:ok
Notably, if you’re reading in external text that has a slash, this will not be lost:
iex(3)> string = IO.gets("Password: ")
Password: my\Password
"my\\Password\n"
iex(4)> IO.puts string
my\Password






















