Open Linuski opened 9 months ago
Does this specification cover all cases?
[
{
"operation": "shift",
"spec": {
"entities": {
"organisations|places": {
"*": {
"id|label": "&2.&1.&"
}
}
}
}
},
{
"operation": "shift",
"spec": {
"*": {
"*": "[]"
}
}
}
]
I have this kind of json: { "entities": { "organisations": [ { "id": "b9c0b61b-e843-48c8-83a2-52bf2ea00971", "label": "ReCAAP ISC" }, ... other things ], "places": [ { "id": "97fe568b-5b25-46dc-bb85-0a7f52996f1d", "label": "Bangladesh" }, ... other things ] } }
I would like to have this: [
{ "id": "b9c0b61b-e843-48c8-83a2-52bf2ea00971", "label": "ReCAAP ISC" }, { "id": "97fe568b-5b25-46dc-bb85-0a7f52996f1d", "label": "Bangladesh" } ]
I used this transformation: [{ "operation": "shift", "spec": { "entities": { "places": { "": "R0[#2]" }, "organisations": { "": "R0[#2]" } } } }, { "operation": "shift", "spec": { "R0": { "*": "" } } } ]
which works well for thsi case but when I have this other case: { "entities": { "organisations": [ { "id": "b9c0b61b-e843-48c8-83a2-52bf2ea00971", "label": "ReCAAP ISC" } ] } } the result is not an array: { "id": "b9c0b61b-e843-48c8-83a2-52bf2ea00971", "label": "ReCAAP ISC" } } How can I fix this?