Output JSON from Bash script

后端 未结 6 1326
暖寄归人
暖寄归人 2020-12-07 18:00

So I have a bash script which outputs details on servers. The problem is that I need the output to be JSON. What is the best way to go about this?

6条回答
  •  囚心锁ツ
    2020-12-07 18:07

    I find it much more easy to create the json using cat:

    cat < /your/path/myjson.json
    {"id" : "$my_id"}
    EOF
    

提交回复
热议问题