title: NodeJS deserialization from a stream
body: <p>I am having an issue deserializing from a stream in node (specifically the pricing feed from the Bitcoin GOX exchange). Basically a chunk arrives which is <strong>well formed complete and verified JSON</strong>. Here is the code:</p>
  
  <pre><code>var gox = require('goxstream');
  var fs = require('fs');
  var options = {
      currency: 'AUD',
      ticker: true,
      depth: false
  };
  
  var goxStream = gox.createStream(options);
  goxStream.on('data', function(chunk) {
  
      console.log(JSON.parse(chunk));
  });
  </code></pre>
  
  <p>When trying to parse it I get the following</p>
  
  <pre><code>undefined:0
  
  ^
  SyntaxError: Unexpected end of input
  </code></pre>
  
  <p>Any ideas? I have included a sample chunk:</p>
  
  <pre><code>&gt; {"channel": "eb6aaa11-99d0-4f64-9e8c-1140872a423d", "channel_name":
  &gt; "ticker.BTCAUD", "op": "private", "origin": "broadcast", "private":
  &gt; "ticker", "ticker": {
  &gt;     "high": {
  &gt;         "value": "121.51941",
  &gt;         "value_int": "12151941",
  &gt;         "display": "AU$121.51941",
  &gt;         "display_short": "AU$121.52",
  &gt;         "currency": "AUD"
  &gt;     },
  &gt;     "low": {
  &gt;         "value": "118.00001",
  &gt;         "value_int": "11800001",
  &gt;         "display": "AU$118.00001",
  &gt;         "display_short": "AU$118.00",
  &gt;         "currency": "AUD"
  &gt;     },
  &gt;     "avg": {
  &gt;         "value": "119.58084",
  &gt;         "value_int": "11958084",
  &gt;         "display": "AU$119.58084",
  &gt;         "display_short": "AU$119.58",
  &gt;         "currency": "AUD"
  &gt;     },
  &gt;     "vwap": {
  &gt;         "value": "119.80280",
  &gt;         "value_int": "11980280",
  &gt;         "display": "AU$119.80280",
  &gt;         "display_short": "AU$119.80",
  &gt;         "currency": "AUD"
  &gt;     },
  &gt;     "vol": {
  &gt;         "value": "249.73550646",
  &gt;         "value_int": "24973550646",
  &gt;         "display": "249.73550646\u00a0BTC",
  &gt;         "display_short": "249.74\u00a0BTC",
  &gt;         "currency": "BTC"
  &gt;     },
  &gt;     "last_local": {
  &gt;         "value": "118.50000",
  &gt;         "value_int": "11850000",
  &gt;         "display": "AU$118.50000",
  &gt;         "display_short": "AU$118.50",
  &gt;         "currency": "AUD"
  &gt;     },
  &gt;     "last_orig": {
  &gt;         "value": "108.99500",
  &gt;         "value_int": "10899500",
  &gt;         "display": "$108.99500",
  &gt;         "display_short": "$109.00",
  &gt;         "currency": "USD"
  &gt;     },
  &gt;     "last_all": {
  &gt;         "value": "118.79965",
  &gt;         "value_int": "11879965",
  &gt;         "display": "AU$118.79965",
  &gt;         "display_short": "AU$118.80",
  &gt;         "currency": "AUD"
  &gt;     },
  &gt;     "last": {
  &gt;         "value": "118.50000",
  &gt;         "value_int": "11850000",
  &gt;         "display": "AU$118.50000",
  &gt;         "display_short": "AU$118.50",
  &gt;         "currency": "AUD"
  &gt;     },
  &gt;     "buy": {
  &gt;         "value": "118.50000",
  &gt;         "value_int": "11850000",
  &gt;         "display": "AU$118.50000",
  &gt;         "display_short": "AU$118.50",
  &gt;         "currency": "AUD"
  &gt;     },
  &gt;     "sell": {
  &gt;         "value": "119.99939",
  &gt;         "value_int": "11999939",
  &gt;         "display": "AU$119.99939",
  &gt;         "display_short": "AU$120.00",
  &gt;         "currency": "AUD"
  &gt;     },
  &gt;     "item": "BTC",
  &gt;     "now": "1376715241731341" }}
  </code></pre>
  
  <p>You can verify it here: <a href="http://jsonlint.com" rel="nofollow">http://jsonlint.com</a></p>
  
  <p>Also it is probably worth mentioning I have already tried parsing and removing the escaped characters. Also have tried a couple of different serializers with the same results</p>