title: Parsing string to JSON using node gives unexpected token, validator says ok
body: <p>I have the following string that I would like to parse to JSON : </p>
  
  <pre><code>{
      "STATUS": [
          {
              "STATUS": "S",
              "When": 1394044643,
              "Code": 17,
              "Msg": "GPU0",
              "Description": "cgminer 3.7.3"
          }
      ],
      "GPU": [
          {
              "GPU": 0,
              "Enabled": "Y",
              "Status": "Alive",
              "Temperature": 70,
              "Fan Speed": 3089,
              "Fan Percent": 70,
              "GPU Clock": 1180,
              "Memory Clock": 1500,
              "GPU Voltage": 1.206,
              "GPU Activity": 99,
              "Powertune": 20,
              "MHS av": 0.4999,
              "MHS 5s": 0.5009,
              "Accepted": 4335,
              "Rejected": 7,
              "Hardware Errors": 0,
              "Utility": 27.8007,
              "Intensity": "0",
              "Last Share Pool": 0,
              "Last Share Time": 1394044643,
              "Total MH": 4676.7258,
              "Diff1 Work": 69436,
              "Difficulty Accepted": 69360,
              "Difficulty Rejected": 112,
              "Last Share Difficulty": 16,
              "Last Valid Work": 1394044643,
              "Device Hardware%": 0,
              "Device Rejected%": 0.1613,
              "Device Elapsed": 9356
          }
      ],
      "id": 1
  }
  </code></pre>
  
  <p>When I use e.g. <a href="http://jsonlint.com/" rel="noreferrer">http://jsonlint.com/</a> it says that the JSON is correct but when I use in node.js: </p>
  
  <pre><code>console.log(JSON.parse(data.toString()));
  </code></pre>
  
  <p>I get the following : </p>
  
  <pre><code>undefined:1
  e Hardware%":0.0000,"Device Rejected%":0.1570,"Device Elapsed":9554}],"id":1}
                                                                               ^
  SyntaxError: Unexpected token
  </code></pre>
  
  <p>Any clue what am I doing wrong here ?</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>The data is coming as ByteStream : </p>
  
  <pre><code>.on('data',function(data){
    console.log(data.toString());
    console.log();
    console.log(data);
    console.log();
    console.log("data "+ data.GPU);
    //...
  
  //...
  {"STATUS":[{"STATUS":"S","When":1394045650,"Code":17,"Msg":"GPU0","Description":"cgminer 3.7.3"}],"GPU":[{"GPU":0,"Enabled":"Y","Status":"Alive","Temperature":70.00,"Fan Speed":3090,"Fan Percent":70,"GPU Clock":1180,"Memory Clock":1500,"GPU Voltage":1.206,"GPU Activity":99,"Powertune":20,"MHS av":0.4999,"MHS 5s":0.5007,"Accepted":4841,"Rejected":8,"Hardware Errors":0,"Utility":28.0261,"Intensity":"0","Last Share Pool":0,"Last Share Time":1394045638,"Total MH":5181.3734,"Diff1 Work":77548,"Difficulty Accepted":77456.00000000,"Difficulty Rejected":128.00000000,"Last Share Difficulty":16.00000000,"Last Valid Work":1394045638,"Device Hardware%":0.0000,"Device Rejected%":0.1651,"Device Elapsed":10364}],"id":1} 
  
  &lt;Buffer 7b 22 53 54 41 54 55 53 22 3a 5b 7b 22 53 54 41 54 55 53 22 3a 22 53 22 2c 22 57 68 65 6e 22 3a 31 33 39 34 30 34 35 32 34 38 2c 22 43 6f 64 65 22 3a 31 ...&gt;
  
  data undefined
  </code></pre>
  
  <p><strong>EDIT</strong> </p>
  
  <p>When I do this : </p>
  
  <pre><code>console.log(data.toString());
  console.log(JSON.stringify(data.toString()));
  </code></pre>
  
  <p>I get the following result : </p>
  
  <pre><code>"{"STATUS":[{"STATUS":"S","When":1394046864,"Code":17,"Msg":"GPU0","Description":"cgminer 3.7.3"}],"GPU":[{"GPU":0,"Enabled":"Y","Status":"Alive","Temperature":70.00,"Fan Speed":3087,"Fan Percent":70,"GPU Clock":1180,"Memory Clock":1500,"GPU Voltage":1.206,"GPU Activity":99,"Powertune":20,"MHS av":0.5000,"MHS 5s":0.5016,"Accepted":5396,"Rejected":8,"Hardware Errors":0,"Utility":27.9597,"Intensity":"0","Last Share Pool":0,"Last Share Time":1394046864,"Total MH":5789.2352,"Diff1 Work":86428,"Difficulty Accepted":86336.00000000,"Difficulty Rejected":128.00000000,"Last Share Difficulty":16.00000000,"Last Valid Work
  ":1394046864,"Device Hardware%":0.0000,"Device Rejected%":0.1481,"Device Elapsed":11580}],"id":1}"
  "{\"STATUS\":[{\"STATUS\":\"S\",\"When\":1394046864,\"Code\":17,\"Msg\":\"GPU0\",\"Description\":\"cgminer 3.7.3\"}],\"GPU\":[{\"GPU\":0,\"Enabled\":\"Y\",\"Status\":\"Alive\",\"Temperature\":70.00,\"Fan Sp
  eed\":3087,\"Fan Percent\":70,\"GPU Clock\":1180,\"Memory Clock\":1500,\"GPU Voltage\":1.206,\"GPU Activity\":99,\"Powertune\":20,\"MHS av\":0.5000,\"MHS 5s\":0.5016,\"Accepted\":5396,\"Rejected\":8,\"Hardw
  are Errors\":0,\"Utility\":27.9597,\"Intensity\":\"0\",\"Last Share Pool\":0,\"Last Share Time\":1394046864,\"Total MH\":5789.2352,\"Diff1 Work\":86428,\"Difficulty Accepted\":86336.00000000,\"Difficulty Re
  jected\":128.00000000,\"Last Share Difficulty\":16.00000000,\"Last Valid Work\":1394046864,\"Device Hardware%\":0.0000,\"Device Rejected%\":0.1481,\"Device Elapsed\":11580}],\"id\":1}\u0000"
  </code></pre>
  
  <p>Notice the last unicode character of the second message <code>\u0000</code> what can I do with it?</p>