Defined in header <nlohmann/json_view.hpp>
template<typename BasicJsonType, bool Editable = false> class basic_json_view;
A read-only handle to one value of a basic_json_document: two pointers (a pointer to the document and a pointer into its index), trivially copyable. A view is valid as long as
read() (or parse() into it) or shrunk with shrink_to_fit() since the view was taken, andMoving the document itself does not invalidate its views: the index is heap-allocated independently of the basic_json_document object.
basic_json_view provides the read-only part of the BasicJsonType interface:
get<T>(), get_string(), number_token(), and materialize() to build the BasicJsonType value of a subtree on demandoperator== and operator!= compare two views, or a view and a BasicJsonType value, without ever building a BasicJsonType value for a view; no ordering comparison (#!cpp operator<) is providedoperator[], at, contains, and value also accept a json_pointer. Unlike basic_json, there are no implicit conversion operators (no #!cpp operator ValueType()), and no #!cpp get_ptr() or #!cpp get_ref(); see get.
basic_json_view itself is always read-only -- it never has a set or push_back of its own. A view of an editable document (#!cpp Editable == true) sees every edit made through basic_json_document::set and basic_json_document::push_back: once a value is changed, every view that still refers to it -- including ones taken before the change -- reads the new value. See Edits.
BasicJsonType : a specialization of basic_json, matching the basic_json_document the view was taken from.
Editable : whether the view is of an editable document, matching the basic_json_document it was taken from (optional, #!cpp false by default). See Edits.
json_documentordered_json_documentjson_editable_documentordered_json_editable_documentbasic_json::value_tBasicJsonType#!cpp std::size_t#!cpp std::string_view on C++17 and newer, a minimal internal substitute otherwisedump() writes numbers#!cpp false)BasicJsonType value of this subtreebasic_json value from a view