Parse JSON to array in a shell script

前端 未结 3 2105
孤独总比滥情好
孤独总比滥情好 2020-12-01 18:49

I\'m trying to parse a JSON object within a shell script into an array.

e.g.: [Amanda, 25, http://mywebsite.com]

The JSON looks like:

{
  \"         


        
3条回答
  •  一个人的身影
    2020-12-01 19:14

    jq is good enough to solve this problem

    paste -s <(jq '.files[].name' YourJsonString) <(jq '.files[].age' YourJsonString) <( jq '.files[].websiteurl' YourJsonString) 
    

    So that you get a table and you can grep any rows or awk print any columns you want

提交回复
热议问题