Files
json/docs/mkdocs/docs/api/basic_json/is_boolean.md
T
Niels Lohmann 172eba6e46 docs: cross-link concept pages and API pages in See also sections
Add See also links in both directions between the concept pages (features,
home, integration) and the API pages, write API links in code font, give every
entry a comment after a dash, and show the callback event figure on the parser
callbacks page.

Signed-off-by: Niels Lohmann <mail@nlohmann.me>
2026-10-26 16:17:03 +01:00

1.0 KiB

nlohmann::basic_json::is_boolean

constexpr bool is_boolean() const noexcept;

This function returns #!cpp true if and only if the JSON value is #!json true or #!json false.

Return value

#!cpp true if type is boolean, #!cpp false otherwise.

Exception safety

No-throw guarantee: this member function never throws exceptions.

Complexity

Constant.

Examples

??? example

The following code exemplifies `is_boolean()` for all JSON types.

```cpp
--8<-- "examples/is_boolean.cpp"
```

Output:

```json
--8<-- "examples/is_boolean.output"
```

See also

Version history

  • Added in version 1.0.0.