#include <stdlib.h>
#include <string.h>
-#include <stdio.h>
#include <errno.h>
#include <stdarg.h>
#include "json.h"
return 0;
}
-static void json_print_array(struct json_array *array, struct buf_output *);
int json_array_add_value_type(struct json_array *array, int type, ...)
{
struct json_value *value;
}
static void json_print_pair(struct json_pair *pair, struct buf_output *);
-static void json_print_array(struct json_array *array, struct buf_output *);
static void json_print_value(struct json_value *value, struct buf_output *);
+
void json_print_object(struct json_object *obj, struct buf_output *out)
{
int i;
static void json_print_value(struct json_value *value, struct buf_output *out)
{
switch (value->type) {
- case JSON_TYPE_STRING: {
- const char delimiter = '"';
- buf_output_add(out, &delimiter, sizeof(delimiter));
- buf_output_add(out, value->string, strlen(value->string));
- buf_output_add(out, &delimiter, sizeof(delimiter));
- break;
- }
+ case JSON_TYPE_STRING:
+ log_buf(out, "\"%s\"", value->string);
+ break;
case JSON_TYPE_INTEGER:
log_buf(out, "%lld", value->integer_number);
break;