Erlang doesn't have any kind of string interpolation. You can do
Body = "{\"auth\": {\"tName\": " ++ TName ++ ", \"passwordCredentials\": {\"username\": " ++ UName ++ ", \"password\": " ++ Password ++ "}}}"
or
Body = lists:append(["{\"auth\": {\"tName\": ", TName, ", \"passwordCredentials\": {\"username\": ", UName, ", \"password\": ", Password, "}}}"])
(Change in the obvious way if you need to add quotes around TName
and the rest.)
Much better, instead of constructing a string like this (do you really want to deal with all the \"
, counting closing braces, etc.?), write a simple function which would take an Erlang term like [{auth, [{tName, TName}, {passwordCredentials, [{userName, UName}, {password, Password}]]]
and builds the JSON string from it (I recommend using binaries instead of strings for TName
etc., since Erlang strings are just lists of numbers, and you may want to have lists of numbers in your term which aren't strings). Or use an existing JSON library (see What is the most mature JSON library for Erlang for some suggestions), especially if you don't just need to build JSON but parse it as well.