#include <glib.h>
#include <glib-object.h>
#include <json-glib/json-glib.h>
#include <stdlib.h>
#include <string.h>

gchar* get_string (JsonNode* root_node) {
	JsonGenerator* gen;
	gen = json_generator_new ();
	json_generator_set_root (gen, root_node);
	return json_generator_to_data (gen, NULL);
}


int main (int argc, char ** argv) {
	JsonNode* root;
	JsonObject* obj;

	g_type_init ();

	root = json_node_new (JSON_NODE_OBJECT);
	json_node_take_object (root, json_object_new ());
	obj = json_node_get_object (root);

	json_object_set_string_member (obj, "member", "foo");
	g_debug ("test-json-set.vala:19: %s", get_string (root));

	json_object_set_string_member (obj, "member", "bar");
	g_debug ("test-json-set.vala:22: %s", get_string (root));

	json_node_free (root);

	return 0;
}

