[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Print bash data structure to json
From: |
Dennis Williamson |
Subject: |
Re: Print bash data structure to json |
Date: |
Tue, 30 Mar 2021 17:26:04 -0500 |
On Tue, Mar 30, 2021, 4:53 PM Peng Yu <pengyu.ut@gmail.com> wrote:
> Hi,
>
> man bash does not mention json. So I assume bash does not support json
> natively?
>
> I see some discussion here on how to print associative arrays to json
> in bash. But the solution is not very nice.
>
>
> https://stackoverflow.com/questions/44792241/constructing-a-json-hash-from-a-bash-associative-array
>
> Is there a clean method to convert arbitrary bash data object (forget
> about function at this moment) to json?
>
> --
> Regards,
> Peng
>
What's not very nice about it? jq is the first tool I would reach for in
such a situation.
>