JSON over stdin/stdout

I’m looking at adding a json over standard I/O pipes option to my tool from last weekend. I’m thinking of this as an intermediate option between interop type solutions (jni, pinvoke and such) and simple command line execution.

Adding in a –jsonrpc option to the tool that selects a mode where json object are read from stdin and json results are emitted to stdout seems like a pretty good option. This should provide an abstracted but tightly coupled interface between a piece of code running as a separate process and a language that may not have access to the APIs needed to get the job done.

This does imply that there will be one subprocess per parent process that needs access. The upside of this is that things remain modular where a problem with one subprocess has no effect on others in the system. We sacrifice a bit of efficiency along the way, but I can’t see that as a major issue in most cases.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.