{"id":2338,"date":"2018-11-05T18:29:14","date_gmt":"2018-11-05T23:29:14","guid":{"rendered":"http:\/\/ninecrows.com\/career\/?p=2338"},"modified":"2018-11-05T13:42:17","modified_gmt":"2018-11-05T18:42:17","slug":"json-over-stdin-stdout-for-small-local-components","status":"publish","type":"post","link":"https:\/\/ninecrows.com\/career\/2018\/11\/05\/json-over-stdin-stdout-for-small-local-components\/","title":{"rendered":"JSON over Stdin\/Stdout for small local components."},"content":{"rendered":"\n<p>I&#8217;m looking at adding a local control capability to my little C++ based file and volume identifier tool. I&#8217;ve run into a number of small functions that would be well served by tools written in specific languages that have access to specialized APIs but would benefit from a local interface with somewhat decent performance.<\/p>\n\n\n\n<p>Unix style text in\/text out is limiting as the command\/response format lacks structure and the performance (with one process start per request) is potentially unacceptable.<\/p>\n\n\n\n<p>Adding in a command line switch that sets the tool into &#8216;json in\/json out&#8217; mode and keeps the program alive until the pipes drop or an exit command is received should address these issues.<\/p>\n\n\n\n<p>Ideally, the stdin and stdout would transport UTF-8 data containing complete JSON entities&#8230;one as a request and one containing the complete response. This can continue until the hosting program sends an EOF or drops the pipes.<\/p>\n\n\n\n<p>I&#8217;m wrapping together a very lightweight JSON generator\/parser to support this effort and will be following that up with some testing of C++\/Java\/C# (and perhaps others) sub-process and pipe management coding. If all goes well, I should have a nice little approach for wrapping small pieces of code that need to run in a particular language but must be hosted elsewhere with decent performance and a robust communications format.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I&#8217;m looking at adding a local control capability to my little C++ based file and volume identifier tool. I&#8217;ve run into a number of small functions that would be well served by tools written in specific languages that have access to specialized APIs but would benefit from a local interface with somewhat decent performance. Unix &hellip; <a href=\"https:\/\/ninecrows.com\/career\/2018\/11\/05\/json-over-stdin-stdout-for-small-local-components\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">JSON over Stdin\/Stdout for small local components.<\/span> <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","enabled":false},"version":2}},"categories":[43,2,22,7],"tags":[],"class_list":["post-2338","post","type-post","status-publish","format-standard","hentry","category-c","category-projects","category-sandbox","category-topics"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p7F2Qc-BI","jetpack-related-posts":[],"jetpack_likes_enabled":true,"_links":{"self":[{"href":"https:\/\/ninecrows.com\/career\/wp-json\/wp\/v2\/posts\/2338"}],"collection":[{"href":"https:\/\/ninecrows.com\/career\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ninecrows.com\/career\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ninecrows.com\/career\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ninecrows.com\/career\/wp-json\/wp\/v2\/comments?post=2338"}],"version-history":[{"count":1,"href":"https:\/\/ninecrows.com\/career\/wp-json\/wp\/v2\/posts\/2338\/revisions"}],"predecessor-version":[{"id":2339,"href":"https:\/\/ninecrows.com\/career\/wp-json\/wp\/v2\/posts\/2338\/revisions\/2339"}],"wp:attachment":[{"href":"https:\/\/ninecrows.com\/career\/wp-json\/wp\/v2\/media?parent=2338"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ninecrows.com\/career\/wp-json\/wp\/v2\/categories?post=2338"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ninecrows.com\/career\/wp-json\/wp\/v2\/tags?post=2338"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}