I have a JSON file like this
{
"hierarchy": {
"structure": {
"card_11001": [
"addCard_4111"
],
"container_11006": [
"mainContainer_11007",
"subContainer_10016"
],
"mainContainer_11007": [
"paymentMethodList_10001"
],
"orderWrap_10012": [
"orderSummary_10005"
],
"paymentMethodList_10001": [
"card_11001",
"placeOrder_10013"
],
"root_10000": [
"payNotice_11011",
"payNotice_10020",
"container_11006",
"placeOrderResultAction_10004"
],
"subContainer_10016": [
"orderWrap_10012",
"footer_10014"
]
}
}
}
And I want to insert
"offline_11018": [
"instruction_908",
"checkboxList_11019"
]
Between "mainContainer_11007"
and "orderWrap_10012"
so the result I want should look like this:
{
"hierarchy": {
"structure": {
"card_11001": [
"addCard_4111"
],
"container_11006": [
"mainContainer_11007",
"subContainer_10016"
],
"mainContainer_11007": [
"paymentMethodList_10001"
],
"offline_11018": [
"instruction_908",
"checkboxList_11019"
],
"orderWrap_10012": [
"orderSummary_10005"
],
"paymentMethodList_10001": [
"card_11001",
"placeOrder_10013"
],
"root_10000": [
"payNotice_11011",
"payNotice_10020",
"container_11006",
"placeOrderResultAction_10004"
],
"subContainer_10016": [
"orderWrap_10012",
"footer_10014"
]
}
}
}
All I know is that I can only append it to the end of file with
jq --raw-output '.hierarchy.structure + {"offline_11018": ["instruction_908","checkboxList_11019"]}'
But that's not what I want, I want to insert it between two other keys. How can I do it with the jq command?