title: How to send Json object through java sockets?
body: <p>How do you send Json object's through sockets preferable through ObjectOutputStream class in java this is what I got so far</p>
  
  <pre><code>    s = new Socket("192.168.0.100", 7777);
      ObjectOutputStream out = new ObjectOutputStream(s.getOutputStream());
      JSONObject object = new JSONObject();
      object.put("type", "CONNECT");
      out.writeObject(object);
  </code></pre>
  
  <p>But this gives an java.io.streamcorruptedexception exception  any suggestions?</p>