I'm using Newtonsoft.Json
to read a .json
file. I need to generically --> It should loop through all the datas where data/count may vary every time.
//var map=new Dictionary<string,string>();
using (StreamReader file = File.OpenText(filepath)){
using (JsonTextReader reader = new JsonTextReader()){
JObject obj = (JObject)JToken.ReadFrom(reader);
while (Reader.read()){
for (int i = 0; i < reader.lineNumber; i++){
if (reader.value != null)
Console.Writeline("Token{i},Tokem{1}", reader.TokenType, reader.TokenValue);
else
Console.Writeline("Token{i}", reader.TokenValue);
i++;
}
}
}
}
How to get these console values returned in a Dictionary/List to make it generic?