Escape JSON in Mix shell echo command

Welcome to the elixir forum.

You have to quote the Json string for echo.

 Mix.Shell.cmd(
    "echo '#{json}'",
    fn x -> IO.puts(x) end
  )
3 Likes