-1

How can you get JSON data dynamically, then output it as a CSV file? Is it possible to get it to output with a change in data?

I have the following code below, but it doesn't work.

var url = "https://reqres.in//api/users?page=2";

using (WebClient webClient = new System.Net.WebClient())
{
  WebClient n = new WebClient();
  var json = n.DownloadString(url);
  string valueOriginal = Convert.ToString(json);
}

I want to get the JSON data from whatever URL and output it as a CSV.

hhello
  • 13
  • 5
John
  • 235
  • 1
  • 5
  • 21

1 Answers1

0

Can you just use CsvHelper? One example can be found from here.

Another option is to write your own implementation to achieve this goal (as shown in example1 or example2).

Good luck.

Ping
  • 124
  • 3