'converting a json file to csv
I am trying to convert a Postman output file from JSON to a CSV. In the past I have just used a json to csv converter but I have some sensitive data for a particular file and do not feel comfortable using an online tool. Searched for some code that might be able to help me with this. When I run this in visual studio I do not see a file created. I will admit I have not done any C# in years and all I really am using it for is to convert this one json file to a csv. Can someone please take a quick look at this code and let me know what I am doing wrong? The jsonInput is not the actual input I am using. Just want to use that as an example. I plan to use a filename for the input but can try figuring that out on my own. Just hoping to get some help to just get a file created.
```
using Aspose.Cells;
using Aspose.Cells.Utility;
using DocumentFormat.OpenXml.Spreadsheet;
using Microsoft.AspNet.SignalR.Json;
// load JSON data
string jsonInput = "[{'nodeId':1,'reputation':1134},{'nodeId':2,'reputation':547},{'nodeId':3,'reputation':1703},{'nodeId':4,'reputation':-199},{'nodeId':5,'reputation':-306},{'nodeId':6,'reputation':-49},{'nodeId':7,'reputation':1527},{'nodeId':8,'reputation':1223}]";
// create a blank Workbook object
var workbook = new Aspose.Cells.Workbook();
// access default empty worksheet
var worksheet = workbook.Worksheets[0];
// set JsonLayoutOptions for formatting
var layoutOptions = new JsonLayoutOptions();
layoutOptions.ArrayAsTable = true;
// import JSON data to CSV
Aspose.Cells.Utility.JsonUtility.ImportData(jsonInput, worksheet.Cells, 0, 0, layoutOptions);
// save CSV file
workbook.Save("Test.csv", SaveFormat.Csv);
```
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
