access specified object element via JSON Pointer with default value

Synopsis

Declared in <nlohmann/json.hpp>

template<class ValueType>
requires detail::is_getable<basic_json_t, ValueType>::value
                   && !std::is_same<value_t, detail::uncvref_t<ValueType>>::value
ValueType
value(
    json_pointer const& ptr,
    ValueType const& default_value) const;

Return Value

value at ptr if found, otherwise default_value

Parameters

Name

Description

ptr

JSON pointer to the element to access

default_value

value to return if ptr does not resolve to a value

Created with MrDocs