jn2integer()

jn2integer()#

Convert a JSON value to an integer. Works with json_t *.

Prototype

PUBLIC int jn2integer(
    json_t      *jn,
    int         default_value
);
        

Parameters

Key

Type

Description

jn

json_t *

The JSON value to convert.

default_value

int

The default value to return if the JSON value cannot be converted to an integer.


Return Value

Returns the integer value, or default_value if the conversion fails.

Prototype

// Not applicable in JS

Prototype

# Not applicable in Python
Examples
// TODO C examples
// TODO JS examples
# TODO Python examples