I have a bulk data inside of CSV to send to an API. the problem is that the api cant accept the data through CSV file type but it must be JSON format first. but the problem i encounter is that i have a specific structure of json that i need to position so that API may read and accept it. is there a way i can position the data that i need to a specific position or variable of the API? thanks!
Hi Jesu,
Could you clarify what you mean by "I need to position so the API may ready and accept it"? This will help us answer your question.
Normally, a JSON API does not require a specific order of attributes; if that is your requirement. However, maybe your API has special requirements.
To convert CSV onto JSON, I would normally consume the API in OutSystems which will create a structure that matches the API.
Then define a structure for the CSV, and import all the rows. There is a forge component that will help you with this.
Then either use ListAppendAll, or a For loop, to add all the records to the list of records in the API request structure.
I hope this helps.
Kind regards,
Stuart
SORRY for the confusion sir "I need to position so the API may ready and accept it"? what i mean by this is that i need to position csv data like id -> API ID like that
what is the forge sir? i might need that thnak you!
https://www.outsystems.com/forge/
forge is where you can found useful component which you can use in outsystems.
Forge is a repository of reusable, open code modules, connectors, UI components, and business solutions to help speed up your OutSystems apps delivery time.
i mean what is the forge that is need thnaks!
There are lots of csv forge component available search as you needed and read document
I am sharing one of the component. you can check it.https://www.outsystems.com/forge/component-overview/10780/csv-to-json-o11
tried this but this wont work
can you please provide more detail that what is not working ? or can you please share csv file so I can try that at my end.
Hi @jesu verso,
I have implemented the logic based on your requirement. Please check out my oml.
Thanks,
Lavanya Kamalaguru
what forge did u use on this sir
You can create structure from your json and use that structure to create csv file.
Can you please share more detail so it will easy to help you.
If possible share oml file.
CSV -> JSON -> API this is the part
I found another one. You can use the Forge component
https://www.outsystems.com/forge/component-overview/636/csvutil
to convert a CSV to an OutSystems record list, which you then can serialize to a JSON structure.
thanks for this!
@jesu verso Try this CSV to XLSX. I am using the same and that is working.
Lavanya
thank you sir