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.

- If the requested type is the current basic_json, or a different basic_json convertible from the current basic_json.

- Otherwise the value is converted by calling the json_serializer<ValueType> from_json() method.

Exceptions

Name Thrown on
what json_serializer<ValueType> from_json() method throws if conversion is required

Return Value

copy of the JSON value, converted to

Template Parameters

Name Description
ValueTypeCV the provided value type
ValueType the returned value type
ValueType if necessary

Created with MrDocs