title: Parse string in Elixir
body: <p>I want to parse a string in Elixir. It obviously is binary. 
  I want to get the value of <code>left_operand</code>, it is '2', but I am not sure how to do it. Because it's like a string, list, tuple mix stuff. </p>
  
  <pre><code>iex(13)&gt; str = "[{\"start_usage\":\"0\",\"left_operand\":\"2\"}]"
  iex(15)&gt; is_binary str
  true
  </code></pre>
  
  <p>The string is JSON format retrieved from MySQL.
  I want to use the devinus/poison module to parse it, but I'm not sure how to deal with the first and last double quotes (<code>"</code>).</p>
  
  <p>It seems that I just need the tuple part so I can do it like </p>
  
  <pre><code>iex(5)&gt; s = Poison.Parser.parse!(~s({\"start_usage\":\"0\",\"left_operand\":\"2\"}))
  %{"left_operand" =&gt; "2", "start_usage" =&gt; "0"}
  iex(6)&gt; s["left_operand"]
  "2"
  </code></pre>
  
  <p>But I don't know how to get the tuple part.</p>
  
  <p>Thanks in advance</p>
  
  <p>EDIT:</p>
  
  <p>I think I figured out how to do it my way.</p>
  
  <pre><code>iex&gt; iex(4)&gt; [s] = Poison.Parser.parse!("[{\"start_usage\":\"0\",\"left_operand\":\"2\"}]")
  [%{"left_operand" =&gt; "2", "start_usage" =&gt; "0"}]
  iex(5)&gt; s
  %{"left_operand" =&gt; "2", "start_usage" =&gt; "0"}
  iex(6)&gt; s["left_operand"]
  "2"
  </code></pre>
  
  <p>I am not sure why this works, <strong>I didn't pass the <code>~s</code> prefix</strong> </p>