UCE Docs / DValue::key

Signature

DValue* DValue::key(String s)
const DValue* DValue::key(String s) const

Parameters

s : child key to find
return value : pointer to existing child, or 0

Looks up one child without creating it. The non-const overload forwards through references; both overloads return 0 for scalars or missing keys.

Example

DValue user;
user["email"] = "ada@example.test";
const DValue* found = user.key("email");
const DValue* missing = user.key("phone");
print(found ? found->to_string() : "none", " / ", missing ? "present" : "absent", "\n");
Output
ada@example.test / absent