I'm using std.json for parsing json. I need to check if a specific string key is in JSONValue.object. The first thing I tried was:

JSONValue root = parseJSON(text);
if(root["key"].isNull == false) {
    //do stuff with root["key"]
}

But that code doesn't work, because calling root["key"] will throw an exception of key not fount if "key" isn't there.

I need some method `root.contains("key")` method to check if the object has a key.

Thanks in advance!

Reply via email to