Issues pulling JSON values out in VB.NET -
i using visual studio 2010 , coding in visual basic. having trouble pulling values out of json file. can top data, nothing lower. tells me "can not convert object string.
here part of json
{ "wp0100300.htm": { "alpha":{ "title": "alphabetical index", "filename": "wp0100300-aindex.txt", "change": "none" }, "t001": { "title": "table 1. summary", "filename": "wp0100300-table1.txt" } }, "wp0100400.htm": { "alpha":{ "title": "alphabetical index", "filename": "wp0100400-aindex.txt", "change": "none" }, "ref": { "title": "reference material required", "filename": "wp0100400-refmatreq.txt", "change": "none" }, } } here portion of code gets values out of json top each works , can pull name (wp0100300.thm) without problem, assumed take value name , parse , run through same each nested name (alpha) , value may title, filename, etc. cannot pull name of first nested section of json. part says alpha, t001, etc.
dim jresults jobject = jobject.parse(rawresp) dim results list(of jtoken) = jresults.children().tolist() each item jproperty in results item.createreader() dim jresults2 jobject = jobject.parse(item.value) dim results2 list(of jtoken) = jresults2.children().tolist() each item2 jproperty in results2 item2.createreader() tvtest.nodes.add(item2.name) next next
alpha's value not string. it's object title, filename , change properties.
if you're trying add name of each 2nd level object treeview, following work:
dim jresults = jobject.parse(rawresp) each item in jresults each item2 jproperty in item.value tvtest.nodes.add(item2.name) next next this simpler doing. gets set in right direction. don't need calls createreader , children.
Comments
Post a Comment