[#nlohmann-basic_json-0c-from_cbor-0e] = xref:nlohmann.adoc[nlohmann]::xref:nlohmann/basic_json-0c.adoc[basic_json]::from_cbor :relfileprefix: ../../ :mrdocs: create a JSON value from an input in CBOR format == Synopsis Declared in `<nlohmann/json.hpp>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<typename T> [[nodiscard, deprecated]] static xref:nlohmann/basic_json-0c.adoc[basic_json] from_cbor( T const* ptr, std::size_t len, bool const strict = true, bool const allow_exceptions = true, xref:nlohmann/basic_json-0c/cbor_tag_handler_t.adoc[cbor_tag_handler_t] const tag_handler = cbor_tag_handler_t::error); ---- [WARNING] ==== https://en.cppreference.com/cpp/language/attributes/deprecated[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 https://en.cppreference.com/cpp/language/attributes/nodiscard[should not be discarded^]. ==== == Parameters [cols="1,4"] |=== | Name| Description | *ptr* | pointer to the start of the input | *len* | length of the input, in bytes | *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 |=== [.small]#Created with https://www.mrdocs.com[MrDocs]#