std.json / nested key/value access?

Robert M. Münch robert.muench at saphirion.com
Fri Nov 15 17:31:28 UTC 2019


On 2019-11-15 17:23:38 +0000, Steven Schveighoffer said:

> On 11/15/19 12:05 PM, Robert M. Münch wrote:
>> JSONValue j = parseJSON(json_string).object;
>> 
>>  writeln(j);                             // works
>>  writeln(j["a"]);                     // works
>>  writeln(j["a"].object["b"]);     // bombs
> 
> Maybe your "a" value is not an object?

Thanks, it's an array... why ever... I need to use:

	writeln(j["a"][0]["b"]);

Wasn't that obvious, because it's a big JSON structure.

-- 
Robert M. Münch
http://www.saphirion.com
smarter | better | faster



More information about the Digitalmars-d-learn mailing list