Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Scenario 1: Create nested json with field names
Expected result;
{
"rootTag": {
"newColumns1": "A",
"newColumn2": "B",
"SUB": [
{
"newColumn3": "C",
"newColumn4": "D",
"SUB2": [
{
"NewCol5": "K",
"NewCol6": "L"
}
]
},
{
"newColumn3": "E",
"newColumn4": "F",
"SUB2": [
{
"NewCol5": "M",
"NewCol6": "N"
}
]
},
{
"newColumn3": "G",
"newColumn4": "H",
"SUB2": [
{
"NewCol5": "O",
"NewCol6": "P"
}
]
},
{
"newColumn3": "X",
"newColumn4": "D",
"SUB2": [
{
"NewCol5": "Q",
"NewCol6": "R"
}
]
},
{
"newColumn3": "Y",
"newColumn4": "D",
"SUB2": [
{
"NewCol5": "S",
"NewCol6": "T"
}
]
}
]
}
}
Scenario 2: Created nested json array where the second level should not have field names.
Expected result.
{
"rootTag": {
"newColumns1": "A",
"newColumn2": "B",
"SUB": [{
"newColumn3": "C",
"newCol4": "D",
"SUB2": ["K", "L"]
}, {
"newColumn3": "E",
"newCol4": "F",
"SUB2": ["M", "N"]
}, {
"newColumn3": "G",
"newCol4": "H",
"SUB2": ["O", "P"]
}, {
"newColumn3": "X",
"newCol4": "D",
"SUB2": ["Q", "R"]
}, {
"newColumn3": "Y",
"newCol4": "D",
"SUB2": ["S", "T"]
}]
}
}
The sample job structure is as shown below.
In the fixed flow input I am using inline table to populate some sample data.
Lets see the settings from tWriteJsonField. The group by option should be used to to group the values. Here Im considering Col1 & 2 as group by.
The above steps are common for both scenario 1 & 2.
Scenario 1:
The columns 1& 2 are the group by ones and they will have sub elemnets 3 & 4 and 4 will further have sub elements 5 & 6. After adding the first sub element "SUB" add a class attribute and set the fixed value to array. Under the SUB add next sub element as element and set it as loop element. Under this element add another attribute class and set the value to object. Under element add next sub elements (In this case column 3 & 4).
Now the first nest is done.
For the next one, create another sub element "SUB2" and proceed with the same steps.
This will give the output with field names.
SUB2": [
{
"NewCol5": "K",
"NewCol6": "L"
}
]
Scenario 2:
The columns 1& 2 are the group by ones and they will have sub elemnets 3 & 4 and 4 will further have sub elements 5 & 6. After adding the first sub element "SUB" add a class attribute and set the fixed value to array. Under the SUB add next sub element as element and set it as loop element. Under element add next sub elements (In this case column 3 & 4).
Do not add the object attribute in this case and skip adding element under the sub for which you dont need the headers(in this case SUB2)
Now the first nest is done.
For the next one, create another sub element "SUB2" and proceed with the same steps but will skip adding the sub element "element".
This will give the output without the field names.
"SUB2": ["K", "L"]
The sample job structure is as shown below.
In the fixed flow input I am using inline table to populate some sample data.
Lets see the settings from tWriteJsonField. The group by option should be used to to group the values. Here Im considering Col1 & 2 as group by.
The above steps are common for both scenario 1 & 2.
Scenario 1:
The columns 1& 2 are the group by ones and they will have sub elemnets 3 & 4 and 4 will further have sub elements 5 & 6. After adding the first sub element "SUB" add a class attribute and set the fixed value to array. Under the SUB add next sub element as element and set it as loop element. Under this element add another attribute class and set the value to object. Under element add next sub elements (In this case column 3 & 4).
Now the first nest is done.
For the next one, create another sub element "SUB2" and proceed with the same steps.
This will give the output with field names.
SUB2": [
{
"NewCol5": "K",
"NewCol6": "L"
}
]
Scenario 2:
The columns 1& 2 are the group by ones and they will have sub elemnets 3 & 4 and 4 will further have sub elements 5 & 6. After adding the first sub element "SUB" add a class attribute and set the fixed value to array. Under the SUB add next sub element as element and set it as loop element. Under element add next sub elements (In this case column 3 & 4).
Do not add the object attribute in this case and skip adding element under the sub for which you dont need the headers(in this case SUB2)
Now the first nest is done.
For the next one, create another sub element "SUB2" and proceed with the same steps but will skip adding the sub element "element".
This will give the output without the field names.
"SUB2": ["K", "L"]