...

/

Transformation: Convert Response

Transformation: Convert Response

Learn the transformation of response and application configuration.

Convert the response

We’ll need a JSON library to convert the response into a data structure. Searching hex.pm, we found the poison library (no relation to HTTPoison), so let’s add its dependency to our mix.exs file.

defp deps do 
  [
    { :httpoison, "~> 1.0.0" },
    { :poison, "~> 3.1" }, 
  ]
end

If we run mix deps.get, we’ll end up with poison installed.

Next, we convert the body from a string. When we return the message from the GitHub API in gitHub_issues.ex file, we call the Poison.Parser.parse! function as seen below:

def handle_response({ _,
...