[#nlohmann-basic_json-0c-from_bson-0a] = xref:nlohmann.adoc[nlohmann]::xref:nlohmann/basic_json-0c.adoc[basic_json]::from_bson :relfileprefix: ../../ :mrdocs: create a JSON value from an input in BSON format (iterator pair, or iterator+sentinel pair for C++20 ranges support) == Synopsis Declared in `<nlohmann/json.hpp>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template< typename IteratorType, typename SentinelType = IteratorType> requires detail::can_compare_ne<IteratorType, SentinelType>::value [[nodiscard]] static xref:nlohmann/basic_json-0c.adoc[basic_json] from_bson( IteratorType first, SentinelType last, bool const strict = true, bool const allow_exceptions = true); ---- == 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 | *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 |=== [.small]#Created with https://www.mrdocs.com[MrDocs]#