title: JSON parsing in web socket server
body: <p>I have created my web socket server and client using this simple tutorial here : <a href="http://cjihrig.com/blog/creating-your-own-node-js-websocket-echo-server/" rel="nofollow">http://cjihrig.com/blog/creating-your-own-node-js-websocket-echo-server/</a>  </p>
  
  <p>But it seems like it recognises only UTF-8 characters.<br>
  I want to send JSON message in the text box:</p>
  
  <pre><code>var jsonString = JSON.stringify({"fname":"John","lname":"Smith"})
  </code></pre>
  
  <p>and in ws_server.js file, I have written  </p>
  
  <pre><code>connection.on('message', function(message) {  
  var jObject = JSON.parse(message); 
  jObject.lname = "Jobs";  
  }..  
  </code></pre>
  
  <p>But I am getting error for JSON.parse method.  </p>
  
  <p>Please let me know what is the problem.<br>
  Or do I have to write any new server implementation for JSON parsing or JSON messages?</p>
  
  <p>This is my client code: <a href="http://cjihrig.com/blog/creating-your-own-websocket-echo-client/" rel="nofollow">http://cjihrig.com/blog/creating-your-own-websocket-echo-client/</a><br>
  but value of "text" is modified to be as follows:<br>
      jsonmsg = {fname:"John",lname:"Smith"}<br>
      jsonString = JSON.stringify(jsonmsg);<br>
  So      socket.send(jsonString);  </p>
  
  <p>Thanks<br>
  Sneha</p>