'Is there a way to instantiate key with JQ?
Is there a way for jq to instantiate a key to output?
Given:
{
"foo": "bizz",
"bar": "buzz",
"bat": [
"somestring"
]
}
I would like to do something like jq '. | {foobar.foo, foobar.bar}'
and have it output:
{
"foobar": {
"foo": "bizz",
"bar": "buzz"
}
}
without having to make the initial foobar dictionary.
Solution 1:[1]
Another possibility to consider:
{foobar: del(.bat)}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | peak |
