aceminer
aceminer

Reputation: 4295

Passing objects between python and java via json

I would need some interprocess communication via stdin and stdout between a python script and a java engine.

Is there anyway I could convert a python object into JSON and converting this whole object as a string to be passed via stdin to Java and converting that string back to JSON for processing before returning it back to python as a JSON object converted via a string

In Summary this is what I need

Python Object-> JSON -> String -> Stdin -> String -> JSON in java ->processing -> JSON -> String -> Stdout -> python -> String -> JSON

Any other solutions that satisfy this condition is also acceptable.

I would just like to know if its possible to send a JSON object via stdin or what are the possible ways to do it

Upvotes: 0

Views: 6364

Answers (1)

DaedalusUsedPerl
DaedalusUsedPerl

Reputation: 772

Here is how you would convert a Python object to JSON, here is an article showing how to use JSR 353 to parse JSON, and consider using sockets for IPC.

Upvotes: 2

Related Questions