GNOME Bugzilla – Bug 621141
JsonBuilder
Last modified: 2012-03-13 22:08:45 UTC
Convenience builder API for creating JSON trees.
Created attachment 163227 [details] [review] JsonBuilder component for json-glib Inspired by http://www.json.org/javadoc/org/json/JSONWriter.html
Review of attachment 163227 [details] [review]: looks good, except for two minor points ::: json-glib/json-builder.c @@ +183,3 @@ + * This call automatically reduces the reference count on builder by one. + * Unless you've taken other actions, this is usually sufficient to free builder. + * I'm not a fan of this "close to unref" behaviour. I'd much prefer close() to behave like GChecksum in GLib: maintain the JsonNode until json_build_reset() is called - a method which will allow to start from scratch re-using the same JsonBuilder instance. this also means adding a json_builder_get_root() or json_builder_get_node(), returning the root node. ::: json-glib/tests/builder-test.c @@ +35,3 @@ + + json_builder_add_string_value (builder, "after array"); + json_builder_end_array (builder); // depth2 please, no C99
Created attachment 163333 [details] [review] JsonBuilder component for json-glib updated - Removed close(), added get_root() and reset(). - Added /builder/reset test.
Attachment 163333 [details] pushed to json-glib master
[Fixing Default QA assignee for json-glib - see 613232#c1. Sorry for bugmail noise.]