Our great sponsors
-
WorkOS
The modern identity platform for B2B SaaS. The APIs are flexible and easy-to-use, supporting authentication, user identity, and complex enterprise features like SSO and SCIM provisioning.
-
libxo
The libxo library allows an application to generate text, XML, JSON, and HTML output using a common set of function calls. The application decides at run time which output style should be produced.
You can achieve the goals of Unix philosophy without being line-oriented - lines are just a means to a goal and we shouldn't hold on to them too dearly if/when something better comes along. I don't think JSON as an output option is the answer but there have been some interesting experiments about making shells more useful in a modern environment by using structured data in place of plaintext, most notably nushell. I think something like that is definitely the way forward, even if it means that all the basic command line tools will need at least partial rewrites.
libxo allows switching the output format (plaintext, JSON, XML, HTML)
you can use ndjson, where valid JSON objects are streamed with newline delimiters. Technically, you could also stream an Array of Objects by starting a stream with [ and using comma separators, but that would make piping to e.g. jq much harder