summaryrefslogtreecommitdiff
path: root/json-glib/json-node.c
diff options
context:
space:
mode:
Diffstat (limited to 'json-glib/json-node.c')
-rw-r--r--json-glib/json-node.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/json-glib/json-node.c b/json-glib/json-node.c
index 3d434f3..c51ee7f 100644
--- a/json-glib/json-node.c
+++ b/json-glib/json-node.c
@@ -654,6 +654,12 @@ json_node_get_int (JsonNode *node)
if (JSON_VALUE_HOLDS_INT (node->data.value))
return json_value_get_int (node->data.value);
+ if (JSON_VALUE_HOLDS_DOUBLE (node->data.value))
+ return json_value_get_double (node->data.value);
+
+ if (JSON_VALUE_HOLDS_BOOLEAN (node->data.value))
+ return json_value_get_boolean (node->data.value);
+
return 0;
}
@@ -699,6 +705,12 @@ json_node_get_double (JsonNode *node)
if (JSON_VALUE_HOLDS_DOUBLE (node->data.value))
return json_value_get_double (node->data.value);
+ if (JSON_VALUE_HOLDS_INT (node->data.value))
+ return (gdouble) json_value_get_int (node->data.value);
+
+ if (JSON_VALUE_HOLDS_BOOLEAN (node->data.value))
+ return (gdouble) json_value_get_boolean (node->data.value);
+
return 0.0;
}
@@ -744,6 +756,12 @@ json_node_get_boolean (JsonNode *node)
if (JSON_VALUE_HOLDS_BOOLEAN (node->data.value))
return json_value_get_boolean (node->data.value);
+ if (JSON_VALUE_HOLDS_INT (node->data.value))
+ return json_value_get_int (node->data.value) != 0;
+
+ if (JSON_VALUE_HOLDS_DOUBLE (node->data.value))
+ return json_value_get_double (node->data.value) != 0.0;
+
return FALSE;
}