我正在使用jq
來改寫我的JSON
。JSON中的Concat 2字段使用jq
JSON字符串:
{"channel": "youtube", "profile_type": "video", "member_key": "hello"}
通緝輸出:
{"channel" : "profile_type.youtube"}
我的命令:
echo '{"channel": "youtube", "profile_type": "video", "member_key": "hello"}' | jq -c '. | {channel: .profile_type + "." + .member_key}'
我知道下面的命令會將字符串。但它不是在同一個邏輯工作如上:
echo '{"channel": "youtube", "profile_type": "video", "member_key": "hello"}' | jq -c '.profile_type + "." + .member_key'
怎麼能只用JQ我實現我的結果?
我想我要做的正好與我的YouTube API腳本同樣的事情;) –