question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Convert Json string to CSV string

See original GitHub issue

I would like to know how can I convert the json string to a csv string without saving the files to the computer. The code I’m using reads and writes to PC files, but I’d like to use it without dealing with the files.

The code that I was using is this:

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

I would like a code like this:

public string json2CSV(string jsonData)
{
 string csvData;
 //Convert jsonData and save in csvData...
 //...
 return csvData;
}

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
Cinchoocommented, Nov 21, 2018

LoadText is static member.

using (var r = ChoJSONReader.LoadText(jsonText))
{
 using (var w = new ChoCSVWriter(csvData).WithFirstLineHeader())
 {
  w.Write(r);
 }
}

For .NET core, use ChoETL.JSON.NETStandard package.

0reactions
mrp100461commented, Jun 24, 2022

Thanks

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to Convert a JSON String to CSV using Python
Step 1: Prepare a JSON String · Step 2: Create the JSON File · Step 3: Install the Pandas Package · Step 4:...
Read more >
How to convert JSON to CSV format and store in a variable
map(fieldName => JSON.stringify(row[fieldName], replacer)).join(',')); csv.unshift(header.
Read more >
How to Convert JSON to CSV in Python
Use Pandas to Convert JSON to CSV ; Import Pandas. Import Pandas using import pandas as pd ; Load the JSON string as...
Read more >
JSON To CSV Converter
Use this tool to convert JSON into CSV (Comma Separated Values) or Excel. Buy ConvertCSV a Coffee at ko-fi.com · Step 1: Select...
Read more >
Pandas - Convert JSON to CSV
pandas is a library in python that can be used to convert JSON (String or file) to CSV file, all you need is...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found