Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Independent validation for trusted, AI-ready data integration. See why IDC named Qlik a Leader: Read the Excerpt!
cancel
Showing results for 
Search instead for 
Did you mean: 
unTalended
Contributor
Contributor

Converting complex JSON to XML

Hello everyone,

actually I am struggeling to figure out how to convert following JSON-structure (in an file) to an equivalent XML-structure to save it also in a file.

 

My structure in the JSON-file:

{

    "stations":[

        {

            "id":"5475",

            "name":"Stationname_1",

            "poles":[

                {

                    "location":

                    {

                        "lat":36.4767361,

                        "long":12.4574503

                    },

                    "id":"54751"

                }

            ]

        },

        {

            "id":"1952",

            "name":"Stationname_2",

            "poles":[

                {

                    "location":{

                        "lat":36.3712358,

                        "long":12.7045717

                    },

                    "id":"19521"

                },

                {

                    "location":{

                        "lat":36.3720289,

                        "long":12.7013738

                    },

                    "id":"19522"

                }

            ]

        }

    ]

}

 

How you can see the "stations"-attribute is an array including various amount of stations-objects. Every station-object is containing a "poles"-attribute which is also an array containing various amount of objects.

 

I created structures for the input and the output and also a mapping. The "stations" and "poles" attributes I configured as "sequence" group type.

 

Created mapping:

0693p000008vXzjAAE.png

 

Configuration structure (dump):

0693p000008vXztAAE.png

 

My problem is that I am using tHMap the first time and have no idea how to configure it (

in "Talend Data Services Platform 7.3.1"), especially to handle the arrays, to get an solution. Also I doesn't know the configuration of tFileInputJSON is alright.

 

Configuration tFileInputJSON:

0693p000008vY1BAAU.png

 

 

Can you also explain me why "id" wasn't connected? It is very confusing.

 

Connection map:

0693p000008vY0rAAE.png

 

 

Sorry for my many questions! I would be very grateful for your help!

 

Friendly greetings

unTalended

Labels (4)
1 Reply
manodwhb
Champion II
Champion II

@not specified not specified​ , you need to read your json file using tFileInput and pass to the tHmap,if you have loop on the particular field it will pass a array when you have multiple values.