+struct callback_data_s
+{
+ graph_config_t *cfg;
+ int limit;
+ _Bool first;
+};
+typedef struct callback_data_s callback_data_t;
+
+static int json_begin_graph (graph_config_t *cfg) /* {{{ */
+{
+ char desc[1024];
+
+ if (cfg == NULL)
+ return (EINVAL);
+
+ graph_get_title (cfg, desc, sizeof (desc));
+
+ printf ("{\"title\":\"%s\",\"instances\":[", desc);
+
+ return (0);
+} /* }}} int json_begin_graph */
+
+static int json_end_graph (void) /* {{{ */
+{
+ printf ("]}");
+
+ return (0);
+} /* }}} int json_end_graph */
+
+static int json_print_instance (graph_config_t *cfg, /* {{{ */
+ graph_instance_t *inst)
+{
+ char params[1024];
+ char desc[1024];
+
+ if ((cfg == NULL) || (inst == NULL))
+ return (EINVAL);
+
+ memset (desc, 0, sizeof (desc));
+ inst_describe (cfg, inst, desc, sizeof (desc));
+
+ memset (params, 0, sizeof (params));
+ inst_get_params (cfg, inst, params, sizeof (params));
+
+ printf ("{\"description\":\"%s\",\"params\":\"%s\"}",
+ desc, params);
+
+ return (0);
+} /* }}} int json_print_instance */
+
+static int print_graph_inst_json (graph_config_t *cfg, /* {{{ */