JSON string to CSV and CSV to JSON conversion in c#

前端 未结 6 612
滥情空心
滥情空心 2020-11-28 08:01

I\'m working with JSON/CSV files in my asp.net web API project and tried with CSVHelper and ServiceStack.Text libraries but couldn\'t make it work.

The JSON file con

6条回答
  •  眼角桃花
    2020-11-28 09:05

    I don't know if this is too late to report solution for your question. Just in case if you want to explore open source library to do the job, here is one

    Cinchoo ETL makes it easy to convert JSON to csv with few lines of code

    using (var r = new ChoJSONReader("sample.json"))
    {
        using (var w = new ChoCSVWriter("sample.csv").WithFirstLineHeader())
        {
            w.Write(r);
        }
    }
    

    For more information / source, go to https://github.com/Cinchoo/ChoETL

    Nuget package:

    .NET Framework:

          Install-Package ChoETL.JSON
    

    .NET Core:

          Install-Package ChoETL.JSON.NETStandard
    

    Full Disclosure: I'm the author of this library.

提交回复
热议问题