title: What is the best way to transmit Java objects over a network
body: <p>I am trying to transmit objects of a particular class from one server to another.</p>
  
  <p>The options I'm looking at are:  </p>
  
  <ul>
  <li>Serialize the data as JSON and send
  it over the wire using HTTP, and
  de-serialize at the other end.</li>
  <li>Serialize the data into some binary form and transmit using TCP
  sockets.</li>
  </ul>
  
  <p>What are the best practices in this area? What are the gotchas?</p>
  
  <p>Ideally I would like the interface to be versioned, so the sender and receiver can be upgraded independently.</p>
  
  <p>I'm considering the JSON approach as I already have code that will serialize/deserialize the objects into JSON.</p>