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.

Multiple Json strings to CSV

See original GitHub issue

` private static void Main(string[] args) { List<string> temp = new List<string>(); temp.Add(“{"col1":"123","col2":{"col21":"aaaa"},"col3":null,"col6":"zzzz"}”); temp.Add(“{"col1":"456","col2":null,"col3":{"col4":"bbbb","col5":"cccc"}”);

using (var w = new ChoETL.ChoCSVWriter(Console.Out))
{
    int i = 0;
    foreach (var item in temp)
    {
        using (var r = ChoETL.ChoJSONReader.LoadText(item))
        {
            if (i == 0)
                w.WithFirstLineHeader();
            i++;
            w.Write(r);
        }
    }
}

} `

image

What am I doing wrong here ?

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:9 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
Cinchoocommented, Mar 8, 2022

No, combine to one CSV with all json nodes.

Here is another approach: https://dotnetfiddle.net/sOuwe8

1reaction
Cinchoocommented, Mar 8, 2022

if code, country to come before other fields, here is how you can do so

https://dotnetfiddle.net/x8EagT

Read more comments on GitHub >

github_iconTop Results From Across the Web

Convert multiple JSON Strings to CSV - java
I need help converting a bunch of json strings to CSVs inside a loop for (MyBusinessObj obj:MyBusinessObjects){ String json ...
Read more >
JSON to CSV - Convert document online
How to convert JSON to CSV: ... 1. Click the "Choose Files" button to select multiple files on your computer or click the...
Read more >
How do I use Python to read multiple JSON files and export ...
What I am trying to do is collect a few but same values from many .json ... import json import glob from datetime...
Read more >
How do I convert multiple JSON files to CSV?
One way is to use the built-in CSV module to read the CSV file, and then use the json.dumps() method to convert it...
Read more >
alefianrahman/multiple-json-to-csv: A file converter that ...
A file converter that converts multiple JSON files into a CSV file. Tutorial: How to Use the Script. Clone this GitHub repository into...
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