What is the best way to transmit Java objects over a network
        Posted  
        
            by tomdee
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by tomdee
        
        
        
        Published on 2009-12-02T16:22:07Z
        Indexed on 
            2010/03/18
            9:31 UTC
        
        
        Read the original article
        Hit count: 407
        
I am trying to transmit objects of a particular class from one server to another.
The options I'm looking at are:
- Serialize the data as JSON and send it over the wire using HTTP, and de-serialize at the other end.
- Serialize the data into some binary form and transmit using TCP sockets.
What are the best practices in this area? What are the gotchas?
Ideally I would like the interface to be versioned, so the sender and receiver can be upgraded independently.
I'm considering the JSON approach as I already have code that will serialize/deserialize the objects into JSON.
© Stack Overflow or respective owner