Member since
05-25-2022
3
Posts
0
Kudos Received
1
Solution
My Accepted Solutions
Title | Views | Posted |
---|---|---|
2837 | 05-27-2022 01:29 AM |
05-27-2022
01:29 AM
Actually it is not possible to solve this case in one shift - here is discussion and workaround with append subarray to mainarray.
... View more
05-25-2022
09:06 AM
@SAMSAL Thank for your variant, but it is not actually desired, because Subarray may be another structure of jolt rules inside for example like this [
{
"operation": "shift",
"spec": {
"MainArray": {
"*": {
"$": "ResultArray[#2][0]",
"@": "ResultArray[#2][1]"
},
"Subarray": {
"*": {
"$": "ResultArray[#3][#2][0]",
"@": "ResultArray[#3][#2][1]",
"#some_value": "ResultArray[#3][#2][3]"
}
}
}
}
}
] Btw it's my fault cause of not actually correct example (same rules for main and sub arrays)
... View more
05-25-2022
06:21 AM
Hi everyone! I'm trying to flat array and it view as simple case, but I can't reach the goal. Here is simple json input: {
"MainArray": {
"mattr1": "some_value1",
"mattr2": "some_value2",
"Subarray": {
"sattr1": 1,
"sattr2": 2,
"sattr3": 3
}
}
} Then I would like to convert it to array of arrays [key, value], Here is Desired Output: {
"ResultArray" : [
[ "mattr1", "some_value1" ],
[ "mattr2", "some_value2" ],
[ "sattr1", 1 ],
[ "sattr2", 2 ],
[ "sattr1", 3 ]
]
} Here is my spec: [
{
"operation": "shift",
"spec": {
"MainArray": {
"*": {
"$": "ResultArray[#2][0]",
"@": "ResultArray[#2][1]"
},
"Subarray": {
"*": {
"$": "ResultArray[#3][#2][0]",
"@": "ResultArray[#3][#2][1]"
}
}
}
}
}
] And I don't understand how to fix problem when Subarrays is inside extra array in my result: {
"ResultArray" : [
[ "mattr1", "some_value1" ],
[ "mattr2", "some_value2" ],
[
[ "sattr1", 1 ],
[ "sattr2", 2 ],
[ "sattr3", 3 ]
]
]
} Any advise, please.
... View more
Labels:
- Labels:
-
Apache Airflow
-
Apache NiFi