I’m trying to do this:
- connect to an API
- get a JSON response with product information
- convert JSON into XML
- connect to SFTP
- 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.
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.
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:
@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
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
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?
I finally got it.
So I had to make HTTP Request with Parse response activated.
Then I had to transform to JSON (thanks for the tip)
Then the data was ready to convert from JSON to XML
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
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.
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.
Hi @Miguel_Cravidao welcome to the community
Awesome that you managed to figure this out with the help of the community
Thanks so much for stepping back in here and letting us know what your solution looks like. This is greatly appreciated
Thanks for the tip, i’ll try to optimize that and reduce the number of operations!