using System.Text.RegularExpressions;
public static void Main()
string filePath = "Upload/sample_file_1_row.csv";
string csv = File.ReadAllText(filePath);
string csvCleaned = Regex.Replace(csv, "\"[^\"]*(?:\"\"[^\"]*)*\"",
m => m.Value.Replace("\r\n", " ").Replace("\n", " "));
using StringWriter stringWriter = new();
using var choJsonWriter = new ChoJSONWriter(stringWriter)
.Configure(c => c.DefaultArrayHandling = false);
using var choCsvReader = ChoCSVReader.LoadText(csvCleaned)
.Configure(c => c.IgnoreEmptyLine = true)
.Configure(c => c.ErrorMode = ChoErrorMode.IgnoreAndContinue)
.Configure(c => c.IgnoreFieldValueMode = ChoIgnoreFieldValueMode.Null)
.Configure(c => c.NestedKeySeparator = '/');
choJsonWriter.Write(choCsvReader);
string jsonString = stringWriter.ToString();
Console.WriteLine("JSON content as a string:");
Console.WriteLine(jsonString);