nlohmann::basic_json<>::get

get a (pointer) value (explicit)

Synopsis

Declared in <nlohmann/json.hpp>

template<
    typename ValueTypeCV,
    typename ValueType = detail::uncvref_t<ValueTypeCV>>
constexpr
decltype(std::declval<const basic_json_t&>().template get_impl<ValueType>(detail::priority_tag<4> {}))
get() const noexcept(noexcept(std::declval<const basic_json_t &>().template get_impl<ValueType>(detail::priority_tag<4>{})));

Description

Performs explicit type conversion between the JSON value and a compatible value if required.

  • If the requested type is a pointer to the internally stored JSON value that pointer is returned. No copies are made.

Exceptions

NameThrown on
whatjson_serializer<ValueType> from_json() method throws if conversion is required

Return Value

copy of the JSON value, converted to

Template Parameters

NameDescription
ValueTypeCVthe provided value type
ValueTypethe returned value type
ValueTypeif necessary