cmp_two_simple_json()
#
cmp_two_simple_json()
compares two JSON values that are either strings, integers, reals, or booleans. It returns a value indicating their relative order.
Prototype
int cmp_two_simple_json(
json_t *jn_var1, // not owned
json_t *jn_var2 // not owned
);
Parameters
Key |
Type |
Description |
---|---|---|
|
|
The first JSON value to compare. Must be a string, integer, real, or boolean. |
|
|
The second JSON value to compare. Must be a string, integer, real, or boolean. |
Return Value
Returns -1 if jn_var1
is less than jn_var2
, 0 if they are equal, and 1 if jn_var1
is greater than jn_var2
. If either value is a complex JSON type (object or array), they are considered equal.
Notes
This function does not compare JSON objects or arrays. It first attempts to compare as real numbers, then as integers, then as booleans, and finally as strings if necessary.
Prototype
// Not applicable in JS
Prototype
# Not applicable in Python
Examples
// TODO C examples
// TODO JS examples
# TODO Python examples