I have the following JSON including a properties array and I would like to transform it with jolt
JSON INPUT
{
"kind": "product",
"product": {
"id": "product.P-L-0368",
"productNumber": "P-L-0368",
"name": "myProduct"
},
"properties": [
{
"values": [
{
"value": "222"
}
],
"id": "purchase_category",
"type": "string"
},
[
{
"id": "brand",
"type": "string",
"values": [
{
"value": "my_brand",
"language": null,
"unit_of_measure": null
}
]
}
]
]
}
DESIRED OUTPUT
{
"kind": "product",
"product": {
"id": "product.P-L-0368",
"productNumber": "P-L-0368",
"name": "myProduct"
},
"properties": [
{
"values": [
{
"value": "222"
}
],
"id": "purchase_category",
"type": "string"
},
{
"id": "brand",
"type": "string",
"values": [
{
"value": "my_brand",
"language": null,
"unit_of_measure": null
}
]
}
]
}
The problem is, that I do not know how to get rid of the array bracket within the properties array (surrounding the brand object)
If the input is in fixed style, then you can match the second indexed object from the one deeper level such as
[
{
"operation": "shift",
"spec": {
"*": "&", //the elements other than "properties"
"properties": {
"0": "&1",
"1": {
"*": "&2"
}
}
}
}
]