How do I serialize a Java object such that it can be deserialized by pickle (Python)?
I'm using a Python service that uses pickled messages as part of its protoco开发者_开发问答l. I'd like to query this service from Java, but to do so, I need to pickle my message on the client (Java). Are there any implementations of pickle
that run on the JVM (ideally with minimal dependencies)?
Clarification: Modifying the server side is not an option, so while alternate serializations would be convenient, they won't solve the problem here.
Some additional investigation yielded pyrolite, an MIT-licensed library that allows Java and .NET programs to interface with the Python world. In addition to remote object functionality, it (more importantly) includes a pickle
serializer and de-serializer.
You can use a Java JSON serializer like GSON or Jackson to serilaise quite easily and use a python json pickle to deserialize
精彩评论