1 # <small>nlohmann::basic_json::</small>type
4 constexpr value_t type() const noexcept;
7 Return the type of the JSON value as a value from the [`value_t`](value_t.md) enumeration.
11 the type of the JSON value
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` |
28 No-throw guarantee: this member function never throws exceptions.
38 The following code exemplifies `type()` for all JSON types.
41 --8<-- "examples/type.cpp"
47 --8<-- "examples/type.output"
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.