create a JSON value from an input in CBOR format (iterator pair, or iterator+sentinel pair for C++20 ranges support)

Synopsis

Declared in <nlohmann/json.hpp>

template<
    typename IteratorType,
    typename SentinelType = IteratorType>
requires detail::can_compare_ne<IteratorType, SentinelType>::value
[[nodiscard]]
static
basic_json
from_cbor(
    IteratorType first,
    SentinelType last,
    bool const strict = true,
    bool const allow_exceptions = true,
    cbor_tag_handler_t const tag_handler = cbor_tag_handler_t::error);

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

Name

Description

first

iterator to the start of the input

last

iterator to the end of the input, or a sentinel value comparable to first

strict

whether to expect the input to be consumed until EOF

allow_exceptions

whether to throw exceptions in case of a parse error

tag_handler

how to treat CBOR tags

Created with MrDocs