I want to create a serialized Python object from outside of Python (in this case, from Java) in such a way that Python can read it and treat it as if it were an object in Python. I'll start with simpler objects (int, float, String, and so on) but I'd love to know if this can be done with classes as well.
Functionality is first, but being able to do it quickly is a close second. The idea is that I have some data in Java land, but some business logic in Python land. I want to be able to stream data through the python logic as quickly as possible...right now, this data is being serialized as strings and I think this is fairly wasteful.
Thank you in advance
The best answer is to use a standardized format, such as JSON, and write up something to create the objects from that format in Python, and produce the data from Java. For simple things, this will be virtually no effort, but naturally, it'll scale up.
Trying to emulate pickle from within Java will be more effort than it's worth, but I guess you could look into Jython if you were really set on the idea.
Is there a way to efficiently create Python objects from outside of Python?