Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
    Cinchoo
    @Cinchoo
    Hi All, if there is open question related to using ChoETL, please post it here. Glad to help.
    JeremyCaron
    @JeremyCaron
    Hi there. I'm converting csv to JSON with ChoETL and after switching from 1.1.0.4 to 1.2.0.6 my resulting json is different. For a csv field that has quotes around the data, the json went from this in 1.1.0.4: \"StuffTypes\": \"Corporate, Consumer\" to being parsed like this in 1.2.0.6: \"StuffTypes\": \"\\\\"Corporate\",\n \"SomeOtherProperty\": \"Consumer\\\\"\". Are there configuration properties I can flip to get the older behavior?
    That's column's csv data looked like: ,"Corporate, Consumer", which was: ,\"Corporate, Consumer\", after being read into a string in dotnet in both tests.
    JeremyCaron
    @JeremyCaron
    Hmm, maybe this is a bug? I just tried 1.2.0.0 and I got the same output as 1.1.0.4. I will try to narrow down where this changed.
    Cinchoo
    @Cinchoo
    if CSV comes with data with quotes in them, you must explicitly set using .QuoteAllFields()
    JeremyCaron
    @JeremyCaron
    I see - did that change at some point?
    Cinchoo
    @Cinchoo
    yes
    JeremyCaron
    @JeremyCaron
    ok, will give that a try. Thanks!
    Cinchoo
    @Cinchoo
    yw
    Skeferstat
    @Skeferstat

    Hi, I write some data to json format and I get an "unclosed" array, like this:

    [
      {
        "name": "alien,
        "day": "mon"
      },
     {
        "name": "alien2,
        "day": "thd"
      },

    My code:

              StringBuilder sb = new StringBuilder();
                using var csvData = ChoCSVReader.LoadText(stringData).WithFirstLineHeader().WithDelimiter(";");
                using var writer = new ChoJSONWriter(sb);
                writer.Write(csvData);

    So, the closed ] bracket is missig. What I am doing wrong? Thanks!

    Cinchoo
    @Cinchoo
    U need to call writer.Close() method to fix it
    Sorry I’ll take it back my statement. Since u already using Using statement.
    Cinchoo
    @Cinchoo
    Can u tell me what version you using?
    What version are you using?
    Cinchoo
    @Cinchoo
    oh I got it, the fix is to call writer.Close() at the end
    StringBuilder sb = new StringBuilder();
    using var csvData = ChoCSVReader.LoadText(stringData).WithFirstLineHeader().WithDelimiter(";");
    using var writer = new ChoJSONWriter(sb);
    writer.Write(csvData);
    writer.Close();
    Better yet, always use Using statement as below
    StringBuilder sb = new StringBuilder();
    using (var csvData = ChoCSVReader.LoadText(stringData).WithFirstLineHeader().WithDelimiter(";"))
    {
    using (var writer = new ChoJSONWriter(sb))
    {
    writer.Write(csvData);
    }
    }
    hope it helps
    Skeferstat
    @Skeferstat
    Thanks!
    Do you have a new version published?
    Ican add writer.close, no Probleme m.
    Ghost
    @ghost~5e78c7ced73408ce4fddb69f

    Hi there, after installing the .Net Core packages via nuget I get the following error:

    System.IO.FileNotFoundException: Could not load file or assembly 'ChoETL.JSON.Core, Version=1.2.1.2, Culture
    =neutral, PublicKeyToken=null'. The system cannot find the file specified.
    File name: 'ChoETL.JSON.Core, Version=1.2.1.2, Culture=neutral, PublicKeyToken=null'

    What am I missing?

    Cinchoo
    @Cinchoo
    uninstall completely, reinstall ChoETL.JSON.NETStandard
    Ghost
    @ghost~5e78c7ced73408ce4fddb69f
    already tried that, I'll do it again
    Ghost
    @ghost~5e78c7ced73408ce4fddb69f
    same thing after uninstalling and reinstalling that package.
    Ghost
    @ghost~5e78c7ced73408ce4fddb69f

    the same happens with ChoETL.NETStandard when trying the CSVWriter:

    System.IO.FileNotFoundException: Could not load file or assembly 'ChoETL.Core, Version=1.2.1.2, Culture=neutral, PublicKeyToken=null'. The system cannot find the file specified.
    File name: 'ChoETL.Core, Version=1.2.1.2, Culture=neutral, PublicKeyToken=null'