This is an Azure Function that converts CSV text to JSON. It can be used standalone or as the api behind a custom connector in Power Automate.
- Create an Azure app
- Create an Azure function called 'csv2json'in the Azure app based on the HTTP trigger template
- Replace the code in the run.csx file with the code from that file in this repository
- Click on get function url
Optionally you can use the function through a custom connector in Power Automate.
- In Power Automate, go to Data/Custom connectors and click new
- Switch on the Swagger editor
- Copy paste the configuration code from the Power_Automate_Custom_connector.json file in this repository to your custom connector
- Change the host url to the url copied from the Azure function
You can set a parameter called csv in a GET query like so
https://csv-to-json-xyz.azurewebsites.net/api/csv2json?csv=a%3Bb%3Bc%0D%0Ad%3Be%3Bf
Or POST JSON with the csv parameter like so:
{"csv":"a;b;c\nd;e;f"}
In both cases the function will return JSON as the body with the first line of CSV as the variable names. like so:
[{"a":"d","b":"e","c":"f"}]