0

I am getting JSON object from RedCAP API.

var result = redcap_api.ExportRecordsAsync(apiToken).Result;

How do I create a CSV file of result? I have installed NuGet packages RedCapAPI and CsvHelper.

Jay
  • 1
  • 2
  • 1. Don't use ".Result". It is generally not safe and might cause deadlocks. Use var result = await redcap_api.ExportRecordsAsync(apiToken) instead 2. Read the CsvHelper docs: https://joshclose.github.io/CsvHelper/getting-started/ – Shane Nov 09 '22 at 22:30

1 Answers1

0

Do you need the CSV file to be downloaded and saved as a file? Or do you instead need to save the CSV as a variable for later use?

For the first use case, there are a few tools available like this one.

For the second use case, try taking a look here.

Of course, you can likely do both (save the CSV as a file, and then reference the file itself later in the script), but without knowing much more hopefully the above links will help you.