nlohmann::basic_json::from_cbor

create a JSON value from an input in CBOR format

Synopsis

Declared in <nlohmann/json.hpp>

template<typename T>
[[nodiscard, deprecated]]
static
basic_json
from_cbor(
    T const* ptr,
    std::size_t len,
    bool const strict = true,
    bool const allow_exceptions = true,
    cbor_tag_handler_t const tag_handler = cbor_tag_handler_t::error);

WARNING

Deprecated: Since 3.8.0; use from_cbor(ptr, ptr + len). Use of this entity is allowed but discouraged.

Return Value

a JSON value representing the input, or a discarded value if allow_exceptions is false and a parse error occurred

NOTE

The return value should not be discarded.

Parameters

NameDescription
ptrpointer to the start of the input
lenlength of the input, in bytes
strictwhether to expect the input to be consumed until EOF
allow_exceptionswhether to throw exceptions in case of a parse error
tag_handlerhow to treat CBOR tags