title: displaying JSON data in a Phoenix Template
body: <p>I'm trying to simply display some data in a template. But apparently I'm missing a step.</p>
  
  <p>request with HTTPoison</p>
  
  <pre><code>use HTTPoison.Base
  
  @expected_fields ~w(result)   
  
  def process_url(url) do
   "url.json"
  end
  
  def process_response_body(body) do
    body
    |&gt; Poison.decode!
    |&gt; Map.take(@expected_fields)
    |&gt; Enum.map(fn({k ,v}) -&gt; {String.to_atom(k), v} end)
  end
  </code></pre>
  
  <p>controller</p>
  
  <pre><code> def index(conn, _params) do
    response = ApiTest.get!("").body[:result]
    render conn, "index.html", response: response
   end
  </code></pre>
  
  <p>template</p>
  
  <pre><code>&lt;%= @response %&gt;
  </code></pre>
  
  <p>the error is:
   lists in Phoenix.HTML and templates may only contain integers representing bytes, binaries or other lists, got invalid entry</p>
  
  <p>So where do I transform the data to a format that can be displayed in the template? </p>