List Items in a Hierarchical Stage
Posted: Fri Feb 05, 2016 10:24 am
I'm new to the Hierarchical Stage and I'm new to JSON so I'm looking for help how to configure this stage correctly.
This is the desired JSON output that I'm trying to get DataStage to make:
Unfortunately I don't have schema so I'm having to reverse engineer one, this is what I have come up with so far:
The part that I'm stuck on is the square brackets "[" between recipients and targetname. From what I've read online, the brackets mean this is an array or list of items. How do I make and map a list in the assembly editor? It doesn't allow me to mapped a string, it wants a list. In my situation I'll never have more than one target name but the assembly editor still wants a list of 1.
If I remove the bracket from the schema, I can get things to work but the output is missing the required bracket. So I feel as if I'm close if I can just figure out how to get the bracket in the final output.
This is the desired JSON output that I'm trying to get DataStage to make:
Code: Select all
{
"properties": {
"Project_Name": "test",
"Job_Name": "test",
"Status": "test"
},
"recipients": [{
"targetName": "test"
}]
}
Code: Select all
{
"properties":
{
"Project_Name": "string",
"Job_Name": "string",
"Status": "string"
},
"recipients":
[{
"targetName": "string"
}]
}
If I remove the bracket from the schema, I can get things to work but the output is missing the required bracket. So I feel as if I'm close if I can just figure out how to get the bracket in the final output.