digitalmars.D.learn - Parseing single JSON value from webpage
- William Dunne (20/20) Apr 28 2015 Sorry for the noob question.
- Vladimir Panteleev (6/26) Apr 28 2015 auto json = `{"meta" : {"level1trust" : 1, "level2trust" : 9}}`;
Sorry for the noob question. I'm currently trying to parse this bit of json: Array ( [meta] => Array ( [level1trust] => 1 [level2trust] => 9 ) [connections] => Array ( [level1] => Array ( [from] => name ) ///lots more json. This seems like it could be done with std.json, however I'm struggling to understand how using my json object, I can get the value for level1trust Anyone willing to lend a hand?
Apr 28 2015
On Wednesday, 29 April 2015 at 02:34:20 UTC, William Dunne wrote:Sorry for the noob question. I'm currently trying to parse this bit of json: Array ( [meta] => Array ( [level1trust] => 1 [level2trust] => 9 ) [connections] => Array ( [level1] => Array ( [from] => name ) ///lots more json. This seems like it could be done with std.json, however I'm struggling to understand how using my json object, I can get the value for level1trust Anyone willing to lend a hand?auto json = `{"meta" : {"level1trust" : 1, "level2trust" : 9}}`; auto parsed = parseJSON(json); assert(parsed["meta"]["level1trust"].integer == 1); BTW, you probably know that, but your output is not JSON - it looks like a PHP dump.
Apr 28 2015