Page 1 of 1

List Items in a Hierarchical Stage

Posted: Fri Feb 05, 2016 10:24 am
by MrBlack
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:

Code: Select all

{
	"properties": {
		"Project_Name": "test",
		"Job_Name": "test",
		"Status": "test"
	},
	"recipients": [{
		"targetName": "test"
	}]
}
Unfortunately I don't have schema so I'm having to reverse engineer one, this is what I have come up with so far:

Code: Select all

{
	"properties": 
	{
		"Project_Name": "string",
		"Job_Name": "string",
		"Status": "string"
	},
	"recipients": 
	[{
		"targetName": "string"
	}]
}
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.

Posted: Fri Feb 05, 2016 12:37 pm
by eostic
....you can just import "the" desired JSON into the Library manager..."as is"....start with a reasonably complete one --- if it has an "array", be sure that it has multiple values in the sample. You don't need to create a "schema"....just a good, fully populated sample.

Ernie