json_decoder_is_integer()

Determine if a node represents an integer value

Synopsis:

#include <sys/json.h>
bool json_decoder_is_integer(json_decoder_t *decoder,
                             const char *name);

Arguments:

decoder
The JSON decoder instance.
name
The name of the node to examine, or NULL to examine the current node.

Library:

libjson

Description:

This function returns true if the specified or current node is an integer, or false otherwise. This call, along with json_decoder_type() returning JSON_TYPE_NUMBER, can be used to determine if the number value for the node can be returned without error using json_decoder_get_int_ll() or json_decoder_get_double().

Returns:

true
The node represents an integer value that can be safely accessed using json_decoder_get_int_ll().
false
The node does not represent an integer value. In this case, if the node's type is JSON_TYPE_NUMBER, its value can be safely accessed using json_decoder_get_double(). Otherwise, its value should be accessed using the type's corresponding json_get_*() function.