title: Passing a JSON across python socket to Javascript
body: <p>I'm using python socket to communicate with JavaScript clients.</p>
  
  <p><a href="http://docs.python.org/2/library/socket.html" rel="nofollow">http://docs.python.org/2/library/socket.html</a></p>
  
  <p>And following the part of JavaScript code,</p>
  
  <pre><code>ws = new WebSocket("ws://localhost:7777/");
  ws.onopen = function(){
    alert("websocket opened.");
  }
  ws.onclose = function(){
    alert("websocket closed.");
  }
  ws.onmessage = function(e) {
    alert(e.data);
  }
  </code></pre>
  
  <p>I need to pass a json or a string from the python socket to the JavaScript. Still cant find a way to pass a json. Not any encoding mechanism support for that.       </p>