diff options
author | Emmanuele Bassi <ebassi@gnome.org> | 2017-11-14 17:16:40 +0000 |
---|---|---|
committer | Emmanuele Bassi <ebassi@gnome.org> | 2017-11-14 17:16:40 +0000 |
commit | 5b816ff8df9e563c1e9c3ae05ee97d46924f9b40 (patch) | |
tree | a55205f1519a5f563f70df6ae276b5510acffe4e /doc | |
parent | ce0f83a46317482255e5e6afe9b9d57422c6bffb (diff) | |
download | json-glib-5b816ff8df9e563c1e9c3ae05ee97d46924f9b40.tar.gz |
Add with_default() variant for JsonObject getters
When using the typed getters for JsonObject, the existing API will
automatically fail if the member requested is not present. This is
generally good practice, because JSON data typically does not have a
schema, and thus is has to be validated "on the go"; a JSON object
member that contains `null`, or `0`, or `false`, is indistinguishable
from a JSON object member that does not exist, so we cannot simply
return a scalar value and be done with it.
We can provide an escape hatch, though, for the crowd writing parsers
for JSON data; by using Python as the model, we can add methods that
take a default value as a parameter, and return it as a fallback value
if the requested object member does not exist, or if it's set to `null`.
Diffstat (limited to 'doc')
-rw-r--r-- | doc/json-glib-sections.txt | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/doc/json-glib-sections.txt b/doc/json-glib-sections.txt index 44942c4..ada0895 100644 --- a/doc/json-glib-sections.txt +++ b/doc/json-glib-sections.txt @@ -31,18 +31,22 @@ json_object_iter_next <SUBSECTION> json_object_set_array_member json_object_get_array_member +json_object_set_object_member +json_object_get_object_member +json_object_set_null_member +json_object_get_null_member json_object_set_boolean_member json_object_get_boolean_member +json_object_get_boolean_member_with_default json_object_set_double_member json_object_get_double_member +json_object_get_double_member_with_default json_object_set_int_member json_object_get_int_member -json_object_set_null_member -json_object_get_null_member -json_object_set_object_member -json_object_get_object_member +json_object_get_int_member_with_default json_object_set_string_member json_object_get_string_member +json_object_get_string_member_with_default <SUBSECTION Private> JSON_TYPE_OBJECT |