0

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

aceminer
  • 3,657
  • 8
  • 42
  • 92
  • 1
    Pure code-writing requests are off-topic on Stack Overflow -- we expect questions here to relate to *specific* programming problems -- but we will happily help you write it yourself! Tell us [what you've tried](http://whathaveyoutried.com), and where you are stuck. This will also help us answer your question better. – Elliott Frisch Sep 02 '15 at 03:38
  • @ElliottFrisch I am not asking for any codes. I just would like to know if its possible or is it possible to do it this way – aceminer Sep 02 '15 at 03:42
  • Frankly, this reads like a code request to me as well. You should probably edit your question to properly indicate that you wish to know whether or not interprocess communication is possible between a python script and a java engine, via `stdin` and `stdout`. – jaggedSpire Sep 02 '15 at 03:48

1 Answers1

2

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.

Community
  • 1
  • 1
DaedalusUsedPerl
  • 732
  • 4
  • 9
  • 23