This is my payload:
[
[
2452,
1,
"AA",
"SH289122275",
"82310",
"CB",
"83.5"
],
[
3456,
2,
"BB ",
"SH389122275",
"92310",
"BB",
"83.5"
]
]
How to fit my payload into below transformation dynamically (i.e at. [111,"aaa"],[222,"bbb"]), I may get more objects in my payload.
%dw 2.0
output application/java
---
{
attribute: Db::createArray("Database_Config","DEMO_OBJECTS",[
Db::createStruct("Database_Config","DEMO_OBJECT",[111,"aaa"]),
Db::createStruct("Database_Config","DEMO_OBJECT",[222,"bbb"])
])
}
CodePudding user response:
Depends on the structure and order of the data in the input. This is a possible example that you can adapt to your specific needs:
%dw 2.0
output application/java
---
{
attribute: Db::createArray("Database_Config","DEMO_OBJECTS",
payload map
Db::createStruct("Database_Config","DEMO_OBJECT",[ $[0], $[1] ... ]))
}