using c# parse and iterate through json object to address each field -


this simple question can't seem find direct answer. read in single json object. want parse , able directly address token or value , format writing file output, use in application. using c# , newtonsoft library.

my code:

jsontextreader reader = new jsontextreader(re); while (reader.read()) {     if (reader.value != null)     console.writeline("value: {0}", "this value <tags>:  " + reader.value); } 

how can address each line? example, desc , gets reference game world. must commoplace.

thanks,

johnh

use jarray , jobject objects instead, this:

var json = system.io.file.readalltext("yourjsonfilepath"); var objects = jarray.parse(json);  foreach(jobject root in objects) {     foreach(keyvaluepair<string, jtoken> tag in root)     {         var tagname = tag.key;         console.writeline("value: {0}", "this value <tags>:  " + tagname);     } } 

Comments

Popular posts from this blog

java - JavaFX 2 slider labelFormatter not being used -

Detect support for Shoutcast ICY MP3 without navigator.userAgent in Firefox? -

web - SVG not rendering properly in Firefox -