const char* type_name() const noexcept;
Returns the type name as string to be used in error messages -- usually to indicate that a function was called on a wrong JSON type.
a string representation of a the type (value_t
):
Value type | return value |
---|---|
#!json null | "null" |
boolean | "boolean" |
string | "string" |
number (integer, unsigned integer, floating-point) | "number" |
object | "object |
array | "array |
binary | "binary |
discarded | "discarded |
No-throw guarantee: this member function never throws exceptions.
Constant.
??? example
The following code exemplifies `type_name()` for all JSON types. ```cpp --8<-- "examples/type_name.cpp" ``` Output: ```json --8<-- "examples/type_name.output" ```
const char*
and added noexcept
in version 3.0.0.