My application expects Json files coming in two different structure. One file where each line is a complete json and other file which is a Json file. For ex : one file will have this structure
{"Logging": {"LogLevel": {"Default": "Warning", "System": "Warning", "Microsoft": "Warning" }}}
and other file with this structure:
{"Logging": {"LogLevel": {"Default": "Warning",
"System": "Warning",
"Microsoft": "Warning"
}}}
my below code does the deserialization and it works for first structure but fails for other file saying error as
Unexpected end when reading token. Path ''."}
My code :
foreach( var line in lines )
{
var data = JsonConvert.DeserializeObject<JObject>( line);}
I would like to know how can I fix this so that it handles files of both types?