April 29, 2015 Parseing single JSON value from webpage | ||||
|---|---|---|---|---|
| ||||
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?
| ||||
April 29, 2015 Re: Parseing single JSON value from webpage | ||||
|---|---|---|---|---|
| ||||
Posted in reply to William Dunne | 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. | |||
Copyright © 1999-2021 by the D Language Foundation
Permalink
Reply