问题
How can I transform a JSON document like this:
{ "foo": 123, "bar": "abc" }
into something like this:
{ "payload": { "foo": 123, "bar": "abc" } }
using the command line tool jq?
回答1:
You just need to wrap an object around the input.
jq '{payload: .}' some.json
来源:https://stackoverflow.com/questions/53125290/how-to-copy-a-json-document-inside-another-using-jq