title: Do not interpolate newline characters in curl response in strings
body: <p>I'm having a bit of difficulty understanding how to <em>not</em> interpolate escape characters in strings ... particularly those that are returned from a <code>curl</code> response.  I am fetching data that looks like:</p>
  
  <pre><code>{"foo":"bar\r\nbaz"}
  </code></pre>
  
  <p>On its own, <code>curl resource</code> will print out the above no problem.  However, if I use command substitution as in <code>echo $(curl resource)</code>, it will emit:</p>
  
  <pre><code>{"foo":"bar
  baz"}
  </code></pre>
  
  <p>I am trying to use node to parse the JSON as in:</p>
  
  <pre><code>node -e "console.log(JSON.parse('$(curl resource)'))"
  </code></pre>
  
  <p>however it chokes on the interpolated newline characters as well it should because these are not valid in JSON.</p>
  
  <p>I've tried:</p>
  
  <pre><code>node -e $'console.log(JSON.parse(\'$(curl resource)\'))'
  # Shell syntax error on the second `$`
  node -e $'console.log(JSON.parse(\''$(curl resource)$'\'))'
  # Fails to parse JSON due to newline
  </code></pre>
  
  <p>How can I prevent command substitution from interpolating the escape characters.</p>