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
Post a Comment