11-09-2022 10:48 AM
Hi there, I have input of a snap coming in as
but want to have it as and “order-line” renamed as “order-lines”
Basically grouping the “data” segment.
I have tried Join, Group by Field, Mapper snaps but nothing worked. surely I am not doing right.
Any pointers on how to achieve it?
Thanks
Manohar
jsoninput.json (106.8 KB)
11-09-2022 10:46 PM
Hi @manohar ,
How I see it when I use the json file, There are two same ‘data’ objects. One with only orderline and one with the other objects inside so that means that some ‘data’ objects contain the orderline and some does not.
When i try to extend the ‘data’ object with the orderline and rename it. Only the second data object gets the new orderlines object because that ‘data’ object only contains the Order-line the other Data object just gets a ‘null’ value in the orderlines object field.
I don’t know where you get your data from but it seems that not every data object has the order-line.
pipeline below for more explanation
community_pipeline_V1.0_2022_11_10.slp (124.9 KB)
11-10-2022 04:11 AM
Hi @JensDeveloper appreciate your help.
In fact, the orderline is not coming in the ‘data’ object. I just transformed it as below to have it part of the data thinking it might help, like using join as below
‘data’ with out orderlines is coming from different snap and orderlines are coming from different snap
please find attached the input jsons and the json that I am trying to achive as final.
Thank you for you help,
Manohar
input_json2_with_orderlines.json (82.4 KB)
input_json1_with_outorderlines.json (23.2 KB)
Final_Expected_Json_structure.json (2.4 KB)
11-10-2022 04:26 AM
Hey @manohar,
Try the following pipeline. Keep in mind that this will work if you only have these 2 incoming objects.
Structuring Data_2022_11_10.slp (126.1 KB)
11-10-2022 10:22 PM
Hi @bojanvelevski , your solution works like charm…
there’s one issue though. After the Structure Snap, I get Order lines in its original format, as in the right box in below screenshot. but I need the output shown in the left box.
Example -
In
“id”: {
“@type”: “integer”,
“$”: “40114”
},
needs to be transformed to as
“id”: “40114”,
Alos, don’t need some of the nodes like “accounting-total”, “created-at”.
Then there are some like which needs to be mapped as it is
“line-num”: “00010”, to “line-num”: “00010”,
I have tried using another structure, and mapper snaps and they come out as below
Any direction in this case?
Thanks
Manohar