ChoJSONReader
Hi,
I am a newbie to your package which seems excellent so excuse if these questions are of basic nature.
I have a ChoJSONReader reading a JSOn file to convert to CSV, very similar to the code snippet.
But I get this error: ChoETL.ChoReaderException: 'Failed to parse '"' value for 'messagestext' field.' Inner Exception :ArgumentOutOfRangeException: Length cannot be less than zero.
Parameter name: length
Setting error mode to r.ErrorMode(ChoErrorMode.IgnoreAndContinue) avoids it but I am not sure what I am missing her. Is it any record with a null field that is missing?
Best Christian
can u pls post sample json with POCO object structure.
Would be nice to write some dotnetfiddle (https://dotnetfiddle.net/) and share with me.
Hi!
It is fairly straight forward. I dont know what my users will try to parse json files so it has to be generic as I dont know what they will try to put in. I tried with the attached file (has nothing to do with us or the application, it is just data to use for testing).
Here are my code rows. I need the Errormode (IgnoreAndContinue) to make it work.
(I try the same approach with XML but I cant get it to work (same file, just converted to XML, same code below but using ChoXMLReader instead))
Best Christian
Using r As New ChoETL.ChoJSONReader(FilePath)
r.Configuration.FlattenNode = True
r.Configuration.NullValue = " "
r.ErrorMode(ChoErrorMode.IgnoreAndContinue)
'r.Configure( )
'r.Configure(Function(c) CSharpImpl.__Assign(c.FlattenNode, True)).JsonSerializationSettings(Function(s) CSharpImpl.__Assign(s.DateParseHandling, DateParseHandling.None))
Using w = New ChoCSVWriter(DataPath)
w.WithDelimiter(";")
w.QuoteAllFields(True)
w.WithFirstLineHeader()
'w.Configuration.
' csv).WithDelimiter(";").WithFirstLineHeader().Configure(Function(c) CSharpImpl.__Assign(c.IgnoreDictionaryFieldPrefix, True))
w.Write(r)
End Using
End Using