Can I pass a string variable to jq not the file?

前端 未结 7 1291
春和景丽
春和景丽 2020-12-29 03:58

I want to convert JSON string into an array in bash. The JSON string is passed to the bash script as an argument (it doesn\'t exist in a file).

Is there a way of ach

相关标签:
7条回答
  • 2020-12-29 04:36

    Absolutely. Just tell bash to give it a file instead.

    jq '.key' <(echo "$json_data")
    

    And make sure you run it in bash, not sh.

    0 讨论(0)
提交回复
热议问题