I would like to merge two json files with jq
:
Inputs: test1.json
{
"key1": "value1",
"key2": "value2"
}
test2.json
{
"key3": "value3",
"key4": "value4"
}
Expected output:
{
"key1": "value1",
"key2": "value2",
"extra": {
"key3": "value3",
"key4": "value4"
}
}
I know that it would be possible two just merge them without extra
key like that: jq -s '.[0] * .[1]' test1.json test2.json
but that would not add those extra nesting level.