jn2real()

jn2real()#

The function jn2real converts a JSON numeric value to a double-precision floating-point number. It supports JSON integers, real numbers, strings representing numbers, and boolean values.

Prototype

double jn2real(json_t *jn_var);

Parameters

Key

Type

Description

jn_var

json_t *

A pointer to a JSON value that will be converted to a double. It can be an integer, real, string, boolean, or null.


Return Value

Returns the double representation of the JSON value. If the input is null, it returns 0.0.

Notes

If jn_var is a string, it is converted using atof(). Boolean values are mapped to 1.0 (true) and 0.0 (false).

Prototype

// Not applicable in JS

Prototype

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