]> git.proxmox.com Git - ceph.git/blob - ceph/src/jaegertracing/opentelemetry-cpp/third_party/nlohmann-json/doc/mkdocs/docs/api/basic_json/type.md
update ceph source to reef 18.1.2
[ceph.git] / ceph / src / jaegertracing / opentelemetry-cpp / third_party / nlohmann-json / doc / mkdocs / docs / api / basic_json / type.md
1 # <small>nlohmann::basic_json::</small>type
2
3 ```cpp
4 constexpr value_t type() const noexcept;
5 ```
6
7 Return the type of the JSON value as a value from the [`value_t`](value_t.md) enumeration.
8
9 ## Return value
10
11 the type of the JSON value
12
13 | Value type | return value |
14 |---------------------------|----------------------------|
15 | `#!json null` | `value_t::null` |
16 | boolean | `value_t::boolean` |
17 | string | `value_t::string` |
18 | number (integer) | `value_t::number_integer` |
19 | number (unsigned integer) | `value_t::number_unsigned` |
20 | number (floating-point) | `value_t::number_float` |
21 | object | `value_t::object` |
22 | array | `value_t::array` |
23 | binary | `value_t::binary` |
24 | discarded | `value_t::discarded` |
25
26 ## Exception safety
27
28 No-throw guarantee: this member function never throws exceptions.
29
30 ## Complexity
31
32 Constant.
33
34 ## Examples
35
36 ??? example
37
38 The following code exemplifies `type()` for all JSON types.
39
40 ```cpp
41 --8<-- "examples/type.cpp"
42 ```
43
44 Output:
45
46 ```json
47 --8<-- "examples/type.output"
48 ```
49
50 ## Version history
51
52 - Added in version 1.0.0.
53 - Added unsigned integer type in version 2.0.0.
54 - Added binary type in version 3.8.0.