You can only output one top-level object with JOLT, but that object can be an array (your desired output is not valid JSON as-is). If you want a two-element array containing those objects, you can use the following spec:
[{
"operation": "modify-default-beta",
"spec": {
"fullname": "=concat(@(1,flu),'-',@(1,reportId),'-',@(1,Name))"
}
},
{
"operation": "shift",
"spec": {
"*": "[0].&",
"@(1,fullname)": "[1].id",
"#relationship": "[1].type"
}
}]
If you need two JSON objects separated by whitespace, since you've tagged Apache NiFi in this question, you can use JoltTransformRecord with a JsonRecordSetWriter that has the Output Grouping
property set to One Line Per Object
. The formatting won't be exactly the same as above (each object will be on a single line) but it will be two JSON objects separated by whitespace (some systems accept/expect this format).
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…