cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

Merging segments in json

manohar
Contributor

Hi there, I have input of a snap coming in as

image

but want to have it as and โ€œorder-lineโ€ renamed as โ€œorder-linesโ€

image

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)

6 REPLIES 6

JensDeveloper
Contributor II

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)

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
image

โ€˜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)

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)

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.

image

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

image

Any direction in this case?

Thanks
Manohar