title: Javascript from Buffer to JSON
body: <p>I'm using bleno (A node js BLE package) and it uses Buffer to send and receive data. How will I go about getting a Buffer object and converting it into JSON? This is what i have now: </p>
  
  <pre><code>bufferToJson = buffer.toString();
  bufferToJson = JSON.stringify(bufferToJson)
  bufferToJson = JSON.parse(bufferToJson)
  </code></pre>
  
  <p>buffer is where the data is. An example of what buffer can be is <code>{cmd:'echo'}</code> I have tried <code>bufferToJson.cmd</code> and only get undefine. Thanks.</p>