help-bash
[Top][All Lists]
Advanced

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

Re: Print bash data structure to json


From: Peng Yu
Subject: Re: Print bash data structure to json
Date: Tue, 30 Mar 2021 18:35:09 -0500

1. Calling an external command.
2. Have to reformat a bash object in a way that jq accepts.

On 3/30/21, Dennis Williamson <dennistwilliamson@gmail.com> wrote:
> 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.
>
>>
>


-- 
Regards,
Peng



reply via email to

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