Files
json/api/ordered_json_view.md
T
2026-10-21 10:31:00 +00:00

1.0 KiB

nlohmann::ordered_json_view

Defined in header <nlohmann/json_view.hpp>

using ordered_json_view = basic_json_view<ordered_json>;

This type is a basic_json_view of a value of an ordered_json_document.

Examples

??? example

The example below demonstrates how to use the type `nlohmann::ordered_json_view`.

```cpp
#include <iostream>
#include <nlohmann/json_view.hpp>

int main()
{
    nlohmann::ordered_json_document doc = nlohmann::ordered_json_document::parse(R"({"z": 1, "a": 2})");
    nlohmann::ordered_json_view v = doc.root();

    std::cout << std::boolalpha << v.is_object() << ' ' << v.size() << '\n';
}

```

Output:

```json
true 2

```

See also

Version history

Since version 3.13.0.