I am trying to create a jolt transformation in NIFI , I have a JSON message with header, detail and line details as an array with line detail object.
Can we Transform Header/Detail JSON into Detail JSON
One separate JSON for each Detail with 2 New Tags having flattened array of Detail Attribute values of "TRADETYP" and "TRANSPORT_CODE"
"TRADETYPALLLINES": [ "GR","EXP","SE"]
"TRANSPORT_CODE_ALLLINES": [ "BARGE","ES","AR"]
Here is the sample JSON :
{
"TRADE_HEADER": {
"TRADEDETAIL": {
"SEGMENT": "1",
"TRADE_NUM": "NA-152",
"PACKAGE_GUID": "ASDER3785$%SDF",
"TRADEDETAILLINE": [
{
"DOC_QTY": "19956.930",
"ACT_NOM_CONSUMED_QTY": "0.000",
"REM_MAX_QTY_TE": "0.000",
"XMDOCNR": "5025087976",
"DOCITM": "0000012001",
"COMMODITY": "RB",
"TRADING_COMPANY": "3862",
"PERIODICITY": "PRAGUE",
"POSTING_DATE": "20211117",
"MARKET": "CME",
"TRADETYP": "GR",
"MAX_DOC_QTY": "19956.930",
"TRANSPORT_CODE": "BARGE",
"DOCNR": "4700253115"
},
{
"DOC_QTY": "12256.230",
"ACT_NOM_CONSUMED_QTY": "0.000",
"REM_MAX_QTY_TE": "0.000",
"XMDOCNR": "5025092776",
"DOCITM": "0000014021",
"COMMODITY": "RB",
"TRADING_COMPANY": "3862",
"PERIODICITY": "PRAGUE",
"POSTING_DATE": "20211117",
"MARKET": "CME",
"TRADETYP": "EXP",
"MAX_DOC_QTY": "12256.230",
"TRANSPORT_CODE": "ES",
"DOCNR": "4700234521"
},
{
"DOC_QTY": "14256.210",
"ACT_NOM_CONSUMED_QTY": "0.000",
"REM_MAX_QTY_TE": "0.000",
"XMDOCNR": "5025023562",
"DOCITM": "0000012041",
"COMMODITY": "RB",
"TRADING_COMPANY": "3862",
"PERIODICITY": "PRAGUE",
"POSTING_DATE": "20211117",
"MARKET": "CME",
"TRADETYP": "SE",
"MAX_DOC_QTY": "14256.230",
"TRANSPORT_CODE": "AR",
"DOCNR": "4700278453"
}
],
"PACKAGE_SEQ_NBR": "1",
"PACKAGE_SEQ_MAX_NBR": "1"
}
}
}
Desired JSON :
[
{
"TRADERECORD": {
"TRADE_NUM": "NA-152",
"PACKAGE_GUID": "ASDER3785$%SDF",
"DOC_QTY": "19956.930",
"ACT_NOM_CONSUMED_QTY": "0.000",
"REM_MAX_QTY_TE": "0.000",
"XMDOCNR": "5025087976",
"DOCITM": "0000012001",
"COMMODITY": "RB",
"TRADING_COMPANY": "3862",
"PERIODICITY": "PRAGUE",
"POSTING_DATE": "20211117",
"MARKET": "CME",
"TRADETYP": "GR",
"MAX_DOC_QTY": "19956.930",
"TRANSPORT_CODE": "BARGE",
"DOCNR": "4700253115",
"TRADETYPALLLINES": [
"GR",
"EXP",
"SE"
],
"TRANSPORT_CODE_ALLLINES": [
"BARGE",
"ES",
"AR"
]
}
},
{
"TRADERECORD": {
"TRADE_NUM": "NA-152",
"PACKAGE_GUID": "ASDER3785$%SDF",
"DOC_QTY": "12256.230",
"ACT_NOM_CONSUMED_QTY": "0.000",
"REM_MAX_QTY_TE": "0.000",
"XMDOCNR": "5025092776",
"DOCITM": "0000014021",
"COMMODITY": "RB",
"TRADING_COMPANY": "3862",
"PERIODICITY": "PRAGUE",
"POSTING_DATE": "20211117",
"MARKET": "CME",
"TRADETYP": "EXP",
"MAX_DOC_QTY": "12256.230",
"TRANSPORT_CODE": "ES",
"DOCNR": "4700234521",
"TRADETYPALLLINES": [
"GR",
"EXP",
"SE"
],
"TRANSPORT_CODE_ALLLINES": [
"BARGE",
"ES",
"AR"
]
}
},
{
"TRADERECORD": {
"TRADE_NUM": "NA-152",
"PACKAGE_GUID": "ASDER3785$%SDF",
"DOC_QTY": "14256.210",
"ACT_NOM_CONSUMED_QTY": "0.000",
"REM_MAX_QTY_TE": "0.000",
"XMDOCNR": "5025023562",
"DOCITM": "0000012041",
"COMMODITY": "RB",
"TRADING_COMPANY": "3862",
"PERIODICITY": "PRAGUE",
"POSTING_DATE": "20211117",
"MARKET": "CME",
"TRADETYP": "SE",
"MAX_DOC_QTY": "14256.230",
"TRANSPORT_CODE": "AR",
"DOCNR": "4700278453",
"TRADETYPALLLINES": [
"GR",
"EXP",
"SE"
],
"TRANSPORT_CODE_ALLLINES": [
"BARGE",
"ES",
"AR"
]
}
}
]
Here is the Jolt Spec I got to :
[
{
"operation": "shift",
"spec": {
"TRADE_HEADER": {
"TRADEDETAIL": {
"TRADEDETAILLINE": {
"*": {
"#": "[&1]",
"#(2,SEGMENT)": "[&1].SEGMENTH",
"#(2,TRADE_NUM)": "[&1].TRADE_NUM",
"#(2,PACKAGE_GUID)": "[&1].PACKAGE_GUID",
"#(0,TRADETYP)": "[#1].TRADETYP_ALL",
"#(0,TRANSPORT_CODE)": "[#1].TRANSPORT_CODE_ALL"
}
}
}
}
}
},
{
"operation": "shift",
"spec": {
"*": {
"#": "TRADERECORD"
}
}
}
]
The Result of this Spec :
{
"TRADERECORD" : [ {
"DOC_QTY" : "19956.930",
"ACT_NOM_CONSUMED_QTY" : "0.000",
"REM_MAX_QTY_TE" : "0.000",
"XMDOCNR" : "5025087976",
"DOCITM" : "0000012001",
"COMMODITY" : "RB",
"TRADING_COMPANY" : "3862",
"PERIODICITY" : "PRAGUE",
"POSTING_DATE" : "20211117",
"MARKET" : "CME",
"TRADETYP" : "GR",
"MAX_DOC_QTY" : "19956.930",
"TRANSPORT_CODE" : "BARGE",
"DOCNR" : "4700253115",
"SEGMENTH" : "1",
"TRADE_NUM" : "NA-152",
"PACKAGE_GUID" : "ASDER3785$%SDF",
"TRADETYP_ALL" : [ "GR", "EXP", "CR" ],
"TRANSPORT_CODE_ALL" : [ "BARGE", "AR", "LCL" ]
}, {
"DOC_QTY" : "12256.230",
"ACT_NOM_CONSUMED_QTY" : "0.000",
"REM_MAX_QTY_TE" : "0.000",
"XMDOCNR" : "5025092776",
"DOCITM" : "0000014021",
"COMMODITY" : "RB",
"TRADING_COMPANY" : "3862",
"PERIODICITY" : "PRAGUE",
"POSTING_DATE" : "20211117",
"MARKET" : "CME",
"TRADETYP" : "EXP",
"MAX_DOC_QTY" : "12256.230",
"TRANSPORT_CODE" : "AR",
"DOCNR" : "4700234521",
"SEGMENTH" : "1",
"TRADE_NUM" : "NA-152",
"PACKAGE_GUID" : "ASDER3785$%SDF"
}, {
"DOC_QTY" : "14256.210",
"ACT_NOM_CONSUMED_QTY" : "0.000",
"REM_MAX_QTY_TE" : "0.000",
"XMDOCNR" : "5025023562",
"DOCITM" : "0000012041",
"COMMODITY" : "RB",
"TRADING_COMPANY" : "3862",
"PERIODICITY" : "PRAGUE",
"POSTING_DATE" : "20211117",
"MARKET" : "CME",
"TRADETYP" : "CR",
"MAX_DOC_QTY" : "14256.230",
"TRANSPORT_CODE" : "LCL",
"DOCNR" : "4700278453",
"SEGMENTH" : "1",
"TRADE_NUM" : "NA-152",
"PACKAGE_GUID" : "ASDER3785$%SDF"
} ]
}
How do I get the "TRADETYP_ALL" And "TRANSPORT_CODE_ALL" repeated in All Detail records
And I also want to add another TAG "TRADETYP_CODE_ALL" combining the values of "TRADETYP_ALL" And "TRANSPORT_CODE_ALL"
"TRADETYP_CODE_ALL" : [ "GR-BARGE", "EXP-AR", "CR-LCL" ]
Any help in that direction Appreciated.
So far so good, just would be suitable to add a modify transformation spec such as
[
{
"operation": "shift",
"spec": {
"TRADE*": {
"TRADE*": {
"TRADE*": {
"*": {
"#": "a[&1].TRADERECORD",
"#(2,TRADE_NUM)": "a[&1].TRADERECORD.TRADE_NUM",
"#(2,PACKAGE_GUID)": "a[&1].TRADERECORD.PACKAGE_GUID",
"#(0,TRADETYP)": "b[#1].TRADETYPALLLINES",
"#(0,TRANSPORT_CODE)": "b[#1].TRANSPORT_CODE_ALLLINES"
}
}
}
}
}
},
{
"operation": "modify-overwrite-beta",
"spec": {
"a": {
"*": {
"TRADER*": {
"TRADETYPALLLINES": "#(4,b[0].TRADETYPALLLINES)",
"TRANSPORT_CODE_ALLLINES": "#(4,b[0].TRANSPORT_CODE_ALLLINES)"
}
}
}
}
},
{
// get rid of object labels
"operation": "shift",
"spec": {
"a": {
"*": ""
}
}
}
]
the demo on the site http://jolt-demo.appspot.com/ is :
Edit : If you also need to add a new attribute
(namely : "TRADETYP_TCODE_ALL" : [ "GR-BARGE", "EXP-AR", "CR-LCL" ])
composed of concatenated components of newly created arrays, then use the
following one :
[
{
"operation": "shift",
"spec": {
"TRADE*": {
"TRADE*": {
"TRADE*": {
"*": {
"#": "a[&1].TRADERECORD",
"#(2,TRADE_NUM)": "a[&1].TRADERECORD.TRADE_NUM",
"#(2,PACKAGE_GUID)": "a[&1].TRADERECORD.PACKAGE_GUID",
"#(0,TRADETYP)": "b[#1].TRADETYPALLLINES",
"#(0,TRANSPORT_CODE)": "b[#1].TRANSPORT_CODE_ALLLINES"
}
}
}
}
}
},
{
"operation": "modify-overwrite-beta",
"spec": {
"a": {
"*": {
"TRADER*": {
"TRADETYPALLLINES": "#(4,b[0].TRADETYPALLLINES)",
"TRANSPORT_CODE_ALLLINES": "#(4,b[0].TRANSPORT_CODE_ALLLINES)"
}
}
}
}
},
{
"operation": "shift",
"spec": {
"a": {
"*": "&1.&"
},
"b": {
"*": {
"TRADETYPALLLINES": { "*": "&3.&" },
"TRANSPORT_CODE_ALLLINES": { "*": "&3.&" }
}
}
}
},
{
"operation": "modify-overwrite-beta",
"spec": {
"b": {
"*": "=join('-',#(1,&))"
}
}
},
{
"operation": "shift",
"spec": {
"a": {
"*": "&1.&"
},
"b": {
"*": "TRADETYP_TCODE_ALL"
}
}
},
{
"operation": "shift",
"spec": {
"a": {
"*": {
"#": "&",
"#(2,TRADETYP_TCODE_ALL)": "&1.TRADERECORD.TRADETYP_TCODE_ALL"
}
}
}
},
{
// get rid of object labels
"operation": "shift",
"spec": {
"*": ""
}
}
]
Related
I'm coming to the conclusion that Jolt is beyond me.
With this input data:-
{
"cluster_id": "1",
"data": {
"id": 1,
"types": [
{
"incident_id": 10,
"incident_ref": "AAA",
"incident_code": "123",
"incident_date": "2010-11-15T00:01:00Z"
},
{
"incident_id": 20,
"incident_ref": "BBB",
"incident_code": "456",
"incident_date": "2020-11-15T00:01:00Z"
}
]
}
}
Spec:-
[
{
"operation": "shift",
"spec": {
"cluster_id": "id",
"data": {
"types": {
"*": {
"incident_id": "incidents",
"incident_ref": "incidents"
}
}
}
}
}
]
Gives:-
{
"id" : "1",
"incidents" : [ 10, "AAA", 20, "BBB" ]
}
How would I get the result of:-
{
"id" : "1",
"incidents" : [
{"id": 10, "ref": "AAA", "code": "123", date: "2010-11-15T00:01:00Z"},
{"id": 20, "ref": "BBB", "code": "456", date: "2020-11-15T00:01:00Z"},
]
}
Tried a bunch of permutations but getting nowhere!
You can use this spec:
[
{
"operation": "shift",
"spec": {
"*": "id",
"data": {
"types": {
"*": {
"incident_*": "incidents[&1].&(0,1)"
}
}
}
}
}
]
To prevent using incident text in the spec, you can use the below spec:
[
{
"operation": "shift",
"spec": {
"*": "id",
"data": {
"types": {
"*": {
"*_*": "&(0,1)[&1].&(0,2)"
}
}
}
}
}
]
You can use two level of shift transformations by extracting substring from tag names such as
[
{
"operation": "shift",
"spec": {
"*": "id",
"data": {
"types": {
"*": "incidents"
}
}
}
},
{
"operation": "shift",
"spec": {
"id": "&",
"*": {
"*": {
"*_*": "&2[&1].&(0,2)"
}
}
}
}
]
I'm trying to filter away some of the objects in the array that does not meet the condition in a given data. All the idType containing "SAL_EMP" and "MAJ_EMP" shall be removed and return only the remaining objects. But is currently not returning the "filtered" objects into its own parent.
How can modify my spec in order to achieve the desired result?
Input data:
[
{
"type": "front-desk",
"employeeIdDetails": [
{
"id": "900",
"idType": "HR_EMP"
},
{
"id": "100",
"idType": "SAL_EMP"
},
{
"id": "100",
"idType": "MAJ_EMP"
},
{
"id": "120",
"idType": "COL_EMP"
}
]
},
{
"type": "backend",
"employeeIdDetails": [
{
"id": "920",
"idType": "HR_EMP"
},
{
"id": "600",
"idType": "SAL_EMP"
},
{
"id": "160",
"idType": "COL_EMP"
},
{
"id": "400",
"idType": "MAJ_EMP"
}
]
},
{
"type": "middle-end",
"employeeIdDetails": [
{
"id": "220",
"idType": "SAL_EMP"
},
{
"id": "630",
"idType": "SAL_EMP"
},
{
"id": "460",
"idType": "SAL_EMP"
}
]
}
]
Desired data:
[
{
"type": "front-desk",
"employeeIdDetails": [
{
"id": "900",
"idType": "HR_EMP"
},
{
"id": "120",
"idType": "COL_EMP"
}
]
},
{
"type": "backend",
"employeeIdDetails": [
{
"id": "920",
"idType": "HR_EMP"
},
{
"id": "160",
"idType": "COL_EMP"
}
]
},
{
"type": "middle-end",
"employeeIdDetails": [
]
}
]
My current Jolt spec:
[
{
"operation": "shift",
"spec": {
"*": {
"type": {
"*": {
"#(2,employeeIdDetails)": {
"*": {
"idType": {
"HR_EMP": {
"#2": "[]"
},
"COL_EMP": {
"#2": "[]"
}
}
}
}
}
}
}
}
},
{
"operation": "shift",
"spec": {
"*": {
"id": "[&1].id",
"idType": "[&1].idType"
}
}
}
]
Returning result as:
[
{
"id": "900",
"idType": "HR_EMP"
},
{
"id": "120",
"idType": "COL_EMP"
},
{
"id": "920",
"idType": "HR_EMP"
},
{
"id": "160",
"idType": "COL_EMP"
}
]
An option would be walking through employeeIdDetails array in order to apply conditional logic while combining them with the other elements which have the key type as
[
{
"operation": "shift",
"spec": {
"*": {
"type": "#(1,type).&",
"employeeIdDetails": {
"*": {
"idType": {
"SAL_EMP": {
"#2": "[]"
},
"MAJ_EMP": {
"#2": "[]"
},
"*": {
"#2": "#(5,type).&4"
}
}
}
}
}
}
},
{
"operation": "shift",
"spec": {
"*": ""
}
}
]
beneath the common keys named the values of the type elements, and then get rid of those auxiliary keys within the next level of transformation.
Manage to figure out a specs from some samples online.
[
{
"operation": "shift",
"spec": {
"*": { // item array
"*": "[&1].&",
"employeeIdDetails": {
"*": { // fixes array
"idType": {
"HR_EMP|COL_EMP": { // only match the thing you want
"#2": "[&5].employeeIdDetails[]"
}
}
}
}
}
}
}
]
I've been trying to figure out how to get the first value out of an array in my events array in this JSON.
I think I must do something with Cardinality but I can't quite figure it out so any help would be appreciated.
This is what my JSON looks like
{
"rootid": "19718",
"clloadm": "2021-06-01T22:40:02",
"clload": "2021-06-01T21:21:39",
"date": "2021-05-25T21:52:30",
"events": [
{
"done": {
"id": "e0",
"value": "2021-05-29T08:08:19"
},
"id": "e0_event",
"started": {
"id": "e0",
"value": "2021-05-29T08:08:19"
},
"status": "complete"
},
{
"done": {
"id": "e1",
"value": "2021-05-27T02:20:25"
},
"id": "e1_event",
"started": {
"id": "e1",
"value": "2021-05-27T02:20:25"
},
"status": "complete"
},
{
"done": {
"id": "e2",
"value": "2021-05-29T08:08:19"
},
"id": "e2_event",
"started": {
"id": "e2",
"value": "2021-05-29T08:08:19"
},
"status": "complete"
},
{
"done": {
"id": "e3",
"value": "2021-05-29T08:08:19"
},
"id": "e3_event",
"started": {
"id": "e3",
"value": "2021-05-29T08:08:19"
},
"status": "complete"
},
{
"done": {
"id": "e4",
"value": "2021-05-29T08:08:19"
},
"id": "e4_event",
"started": {
"id": "e4",
"value": "2021-05-29T08:08:19"
},
"status": "complete"
}
],
"ids": [
{
"id": "id",
"source": "source",
"value": "value"
}
]
}
My Jolt Spec
[
{
"operation": "shift",
"spec": {
"*": "&",
"events": {
"*": {
"*": {
"#id": {
"e0": { "#(2,value)": "&" },
"e4": { "#(2,value)": "&" }
}
}
}
},
"ids": {
"*": {
"#value": "#id"
}
}
}
}
]
The result I get:
{
"rootid" : "19718",
"clloadm" : "2021-06-01T22:40:02",
"clload" : "2021-06-01T21:21:39",
"date" : "2021-05-25T21:52:30",
"e0" : [ "2021-05-29T08:08:19", "2021-05-29T08:08:19" ],
"e4" : [ "2021-05-29T08:08:19", "2021-05-29T08:08:19" ],
"id" : "value",
"new_id" : "value"
}
I would like the result to be more like this where only the first value is selected:
{
"rootid" : "19718",
"clloadm" : "2021-06-01T22:40:02",
"clload" : "2021-06-01T21:21:39",
"date" : "2021-05-25T21:52:30",
"e0" : "2021-05-29T08:08:19",
"e4" : "2021-05-29T08:08:19",
"id" : "value",
"new_id" : "value"
}
Edit:
I've tried adding the cardinality into my spec, but I can't seem to get the result I want.
[
{
"operation": "shift",
"spec": {
"*": "&",
"events": {
"*": {
"*": {
"#id": {
"e0": { "#(2,value)": "&" },
"e4": {
"operation": "cardinality",
"spec": {
"e4": "ONE"
}
}
}
}
}
},
"ids": {
"*": {
"#value": "#id"
}
}
}
}
]
Yes, you just can add a cardinality transformation such as
{
"operation": "cardinality",
"spec": {
"*": "ONE"
}
}
or optionally use e* wildcard just to restrict the result for the arrays with keys starting with the letter e such as
{
"operation": "cardinality",
"spec": {
"e*": "ONE"
}
}
Edit : just need to add to the current spec. So, you can use the following :
[
{
"operation": "shift",
"spec": {
"*": "&",
"events": {
"*": {
"*": {
"#id": {
"e0": {
"#(2,value)": "&"
},
"e4": {
"#(2,value)": "&"
}
}
}
}
},
"ids": {
"*": {
"#value": "#id"
}
}
}
},
{
"operation": "cardinality",
"spec": {
"e*": "ONE"
}
}
]
How to transform all the keys in this list of jsons to lowercase
[
{
"KEY01": "1111",
"KEY02": "VALUE01",
"KEY03": true
},
{
"KEY01": "2222",
"KEY02": "VALUE02",
"KEY03": true
}
]
desired result
[
{
"key01": "1111",
"key02": "VALUE01",
"key03": true
},
{
"key01": "2222",
"key02": "VALUE02",
"key03": true
}
]
I used this jolt transformation formula and it did only generate an object with values only being transformed to lowercase
[
{
"operation": "modify-overwrite-beta",
"spec": {
"*": {
"*": "=toLower"
}
}
}
]
Result
[{
"KEY01": "1111",
"KEY02": "value01",
"KEY03": true
}, {
"KEY01": "2222",
"KEY02": "value02",
"KEY03": true
}]
This produces the desired result:
[
{
"operation": "shift",
"spec": {
"*": {
"*": {
"$": "[&2].&1.key",
"#": "[&2].&1.value"
}
}
}
},
{
"operation": "modify-overwrite-beta",
"spec": {
"*": {
"*": {
"key": "=toLower"
}
}
}
},
{
"operation": "shift",
"spec": {
"*": {
"*": {
"value": "[&2].#(1,key)"
}
}
}
}
]
Produces the following:
[
{
"key01" : "1111",
"key02" : "VALUE01",
"key03" : true
},
{
"key01" : "2222",
"key02" : "VALUE02",
"key03" : true
}
]
Trying to make a Jolt script that will put in a single number line, then a array of strings in one single array and a tag on the end of that array. These are the values that I have been working with.
JSON INPUT
[
{
"foo": "111",
"bar": "222",
"sun": "333",
"ListofStrings": [
"Dog",
"Train"
],
"ID": "BLAH"
},
{
"foo": "999",
"bar": "222",
"sun": "777",
"ListofStrings": [
"CAT",
"PLANE"
],
"ID": "HAHA"
}
]
JOLT SPEC This is what I have been working with that prints out the ListofStrings but this is the one that works stably.
[
{
"operation": "shift",
"spec": {
"*": {
"foo": "input[].number",
"bar": "input[].number",
"sun": "input[].number",
"ListofStrings": "input[].List"
}
}
},
{
"operation": "default",
"spec": {
"app_id": "test",
"input": {
"*": {
"app_id": "test"
}
}
}
}
]
CURRENT OUTPUT
{
"input" : [ {
"number" : "111"
}, {
"number" : "222"
}, {
"number" : "333"
}, {
"List" : [ "Dog", "Train" ]
}, {
"number" : "999"
}, {
"number" : "222"
}, {
"number" : "777"
}, {
"List" : [ "Cat", "Car" ]
} ],
"app_id" : "test"
}
DESIRED OUTPUT
{
"input" : [ {
"number" : "111"
"List" : [ "Dog", "Train" ]
"ID": "BLAH_foo"
}, {
"number" : "222"
"List" : [ "Dog", "Train" ]
"ID": "BLAH_bar"
}, {
"number" : "333"
"List" : [ "Dog", "Train" ]
"ID": "BLAH_sun"
}, {
"number" : "999"
"List" : [ "Cat", "Car" ]
"ID": "HAHA_foo"
}, {
"number" : "222"
"List" : [ "Cat", "Car" ]
"ID": "HAHA_bar"
}, {
"number" : "777"
"List" : [ "Cat", "Car" ]
"ID": "HAHA_sun"
} ],
"app_id" : "test"
}
Check this spec
[
//Converting list to Map
{
"operation": "shift",
"spec": {
"*": {
"ListofStrings": null,
"*": {
"#": "#1.number",
"#(1,ListofStrings)": "#1.list"
}
}
}
},
//Shift the number and list to the input array
{
"operation": "shift",
"spec": {
"*": {
"$": "input[#2].number",
"#(0,list)": "input[#2].List"
}
}
}, {
"operation": "default",
"spec": {
"app_id": "test",
"input": {
"*": {
"app_id": "test"
}
}
}
}
]
Edit 1
Add the ID node to the map using first shift operation "ID": null, and "#(1,ID)": "#1.ID". Then shift the ID node to the input array in the second shift operation "#(0,ID)": "input[#2].ID".
[
//Converting list to Map
{
"operation": "shift",
"spec": {
"*": {
"ListofStrings": null,
"ID": null,
"*": {
"#": "#1.number",
"#(1,ListofStrings)": "#1.list",
"#(1,ID)": "#1.ID"
}
}
}
},
//Shift the number and list to the input array
{
"operation": "shift",
"spec": {
"*": {
"$": "input[#2].number",
"#(0,list)": "input[#2].List",
"#(0,ID)": "input[#2].ID"
}
}
}, {
"operation": "default",
"spec": {
"app_id": "test",
"input": {
"*": {
"app_id": "test"
}
}
}
}
]