Code only grabs first record from JSON c#

bbcompent1 66 Reputation points
2022-09-29T10:08:41.347+00:00

Greetings folks, I have an application that takes a JSON resource file and is supposed to write the JSON out with all records into a CSV. However, what's happening is it writes the first record and quits. I'm not quite sure what's wrong TBH. I'm going to include the code and a sample file to use for testing so you can replicate my issue. Just for clarification, ensure to name response.txt to response.json. Thanks in advance.246013-exporter-code.txt246041-response.txt

C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,199 questions
{count} votes

2 answers

Sort by: Most helpful
  1. bbcompent1 66 Reputation points
    2022-10-03T14:33:12.317+00:00

    Ok, that worked very well and easy @Mayank Pujara . Now, another question. Is there some method to strip out undesired fields in this CSV output? There are columns I really do not care about, particularly uid, role, confirmed_at, last_sign_in_at,sign_in_count,last_active_at_activated for example. Can I simply call out those column names to remove them from the output of ChoCSV writing?


  2. Mayank Pujara 1 Reputation point
    2022-10-03T15:03:41.637+00:00

    Great to hear it worked .. @bbcompent1