Bash Scripting Help

Hello i need help with bash. I want to run,

./my_file.sh ‘{“field”:“value”}’

i want the script to loop through the json and get the field and able to display the value.

Well, JSON is just a string, you’re gonna have a hell of a job getting bash to extract data from it. Normally you would use bash to call a tool that parses JSON and gets values or (much easier) use that tool directly, so for example jq

1 Like

Thanks @DanCouper , the jq help me out in this.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.