[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Light weight support for JSON

From: Yair Lenga
Subject: Re: Light weight support for JSON
Date: Sun, 28 Aug 2022 14:29:42 -0400

I do not think that JSON (and REST) are "data exchange format of the
month". Those are established formats that are here to stay. Like YAML.
Those are "cornerstones" of cloud computing/configuration. I do not have to
argue for them, they can speak for themselves.

As for using external utilities: two main issues:
* Performance - Processing data in bash processes can be 100X times faster
than using external tools. The fork/exec is expensive. To emphasize, the
intention is not to build ETL processes with bash - those should still use
dedicated tools (or Python or frameworks).
* Readability - Each tool has its own syntax, escapes, etc. The final
result of mixing JQ and bash is not pretty (just lookup jq/bash questions
on stack overflow)
* It is not easy to construct valid (JSON) documents with bash - by
concatenating strings. Many other tools that are used for automation have
support to ensure correctness. will be nice to have the same - it will make
bash more useful for the proper use cases.

Having them as a loadable extension seems like a good practical solution.
They do not have to be "built-in".


On Sun, Aug 28, 2022 at 2:11 PM Lawrence Velázquez <vq@larryv.me> wrote:

> On Sun, Aug 28, 2022, at 9:24 AM, Yair Lenga wrote:
> > Wanted to get feedback about the following "extensions" to bash that will
> > make it easier to work with simple JSON object. To emphasize, the goal is
> > NOT to "compete" with Python/Javascript (and other full scale language) -
> > just to make it easier to build bash scripts that cover the very common
> use
> > case of submitting REST requests with curl (checking results, etc), and
> to
> > perform simple processing of JSON files.
> I do not think bash needs to sprout functionality to support every
> data-exchange format of the month.  A loadable module might be okay,
> I guess.
> Why are people so allergic to just using specific utilities for
> specific tasks, as appropriate?  (This question is rhetorical.
> Please do not respond with an impassioned plea about why JSON is
> so special that it deserves first-class shell support.  It's not.)
> --
> vq

reply via email to

[Prev in Thread] Current Thread [Next in Thread]