:sig u64 DValue::to_u64(u64 default_value = 0) const :params default_value : returned when the value is missing or cannot be parsed as a number return value : the value as an unsigned 64-bit integer, or `default_value` :see >types 0_DValue json_decode int_val to_bool to_s64 to_f64 :content Reads a `DValue` value as an unsigned integer. This is a read accessor: it is `const`, never creates or modifies nodes, and dereferences internal references automatically. String values are trimmed and parsed permissively, like `to_s64()`. Boolean values become `1` or `0`. Negative values clamp to `0`, and results above the `u64` range clamp to the maximum. `default_value` is returned when: - the node is unset or holds an empty string - the string does not parse as a number - the node is map-shaped with more than one entry, or an unresolvable reference A map-shaped node with exactly one entry unwraps to that entry's value before converting. Note that a *present* negative value clamps to `0` rather than returning the default — the default signals "missing or unparseable", not "out of range". ## Example ```cpp u64 limit = context.get["limit"].to_u64(50); u64 owner_id = row.get_by_path("owner/id").to_u64(); ``` Use this for counts, identifiers, limits, timestamps, and other non-negative numeric values stored inside a `DValue`. ## Related Concepts - PHP: `intval()` with a fallback - JavaScript: `parseInt(x) || fallback` (within unsigned range)