Closed Chris-Fri closed 9 months ago
If id a3/2820 is used for a6/868 and a6/489 and not 868/870 as in your example, I proceed in two steps:
[
{ // grouping of attributes based on their position in each table (index)
"operation": "shift",
"spec": {
"data": {
"myItems": {
"*": {
"id": "data.myItems[&1].id",
"usedFor": {
"*": {
"id|localIdentifier": {
"*": { // index (position in array)
"@": "data.myItems[&5].usedFor.&1.&2" // &1 is index and &2 is id or localIdentifier
}
},
"participatesIn": {
"*": {
"*": {
"@": "data.myItems[&6].usedFor.&1.&3.&2"
}
},
"title": {
"*": {
"@": "data.myItems[&6].usedFor.&1.&3.studyScientificTitle"
}
}
}
}
}
}
}
}
}
},
{ // change index list to an array in usedFor
"operation": "shift",
"spec": {
"data": {
"myItems": {
"*": {
"id": "data.myItems[&1].id",
"usedFor": {
"*": {
"*": "data.myItems[&3].usedFor[&1].&"
}
}
}
}
}
}
}
]
That is great. Thank you so much!
Dear all, I have the following json where each entry from "myItems" has an id (e.g. "a3/2820") and an attribute that in turn contains arrays of 2 (or n) items:
And I would like to achieve the json below where for each entry in "myItems" the values in the various arrays are separated into individual objects
I tried with something like the below before but that does not work as it just combines all entries from "myItems" into the first one.
Any hint is highly appreciated! Thanks a lot in advance