How to convert JSON to XML

Hello,

I’m trying to do this:

  1. connect to an API
  2. get a JSON response with product information
  3. convert JSON into XML
  4. connect to SFTP
  5. upload a file in XML format

I’ve done everything but I have no clue how to convert JSON into XML so at the moment i’m creating a file with JSON inside of it.

I tried with Make tools but i can’t see how to do it. Currently im just looking a way to send the JSON somewhere and get and XML file. I want to avoid using code to read the file (with JSON inside) and then convert it into a XML one.

The JSON data is really complex so I’ll use another program that will read the XML file and map the information into a e-Commerce website.

Any clue to how convert a bigh chunk of JSON into XML?

Thanks in advance.

you need to make an xml data structure that matches the json structure. Then parse the json and use the create XML to map to.

1 Like

Hello JonathanX, thanks for your reply.

Yes I tried that but as I said the JSON structure is impossible to map inside MAKE, its really massive in the structure with arrays inside arrays.

i have no idea what the json looks like. So could you show it.

1 Like

Hello,

Thanks again for replying.

This is a sample of the JSON WeTransfer - Send Large Files & Share Photos Online - Up to 2GB Free but it can get up to 35MB of data.

@Miguel_Cravidao What about the “JSON” app with “Convert JSON to XML” module?
Unless you want to remap the XML and change values, this directly converts JSON to XML:

1 Like

@Bjorn.drivn thank you very much that’s exactly what im looking for I dont know how I missed that! I looked so many times and nothing :slight_smile:

Although I can’t make it work like you. I used HTTP Make Request to allow me to use a Auth Token and I get this output:

Up to 50 products with this collection:

Seems great, but when i try to convert this into XML

I get this:

Or if i try just the products:

I get this:

So im clearly missing something here :slight_smile:

Tried with data:

Maybe i need some sort of Aggregator?
Here the output from HTTP Request: WeTransfer - Send Large Files & Share Photos Online - Up to 2GB Free

I see you used HTTP Get File and converted to XML right away, but seems you just pasted some JSON directly for testing purposes but I should work with HTTP Make a Request, right?

Thanks again.

1 Like

Hello,

I finally got it.

  1. So I had to make HTTP Request with Parse response activated.
    image

  2. Then I had to transform to JSON (thanks for the tip)

  3. Then the data was ready to convert from JSON to XML

  4. From here i could finally upload the XML into a file via SFTP

So before, I was saving a file but not in the JSON format even if it looked to me it was JSON, that’s why I was missing all the steps and getting all sort of errors.

From the HTTP Request I was just getting a Collection instead a JSON string as I always thought
image

Only with the Parse Response and after JSON transformation I got a JSON string to work with

This is the final scenario

Please ignore the last message and thanks to all that tried to help.

2 Likes

You could also turn off Parse Response in the HTTP module and avoid the Transform To JSON module (one operation). You’ll get the full JSON text from HTTP ready to be sent to the JSON to XML module.

2 Likes

Hi @Miguel_Cravidao welcome to the community :wave:

Awesome that you managed to figure this out with the help of the community :clap:

Thanks so much for stepping back in here and letting us know what your solution looks like. This is greatly appreciated :pray:

1 Like

Thanks for the tip, i’ll try to optimize that and reduce the number of operations!

1 Like