/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2012 Index Data
+ * Copyright (C) 1995-2013 Index Data
* See the file LICENSE for details.
*/
/**
json_parser_t json_parser_create(void)
{
json_parser_t p = (json_parser_t) xmalloc(sizeof(*p));
-
+
p->buf = 0;
p->cp = 0;
p->err_msg = 0;
}
n = json_new_node(p, json_node_string);
dst = n->u.string = (char *) xmalloc(l + 1);
-
+
cp = p->cp;
while (*cp && *cp != '"')
{
}
m2 = json_new_node(p, json_node_list);
m2->u.link[0] = n2;
-
+
m1->u.link[1] = m2;
m1 = m2;
}
}
m2 = json_new_node(p, json_node_list);
m2->u.link[0] = n2;
-
+
m1->u.link[1] = m2;
m1 = m2;
}
{ /* leave encoding as raw UTF-8 */
wrbuf_putc(b, cp[i]);
}
- }
-
+ }
+
}
void wrbuf_json_puts(WRBUF b, const char *str)
wrbuf_puts(result, "{");
if (indent >= 0)
{
- wrbuf_puts(result, "\n");
+ wrbuf_puts(result, "\n");
json_indent(result, sub_indent);
}
if (node->u.link[0])
struct json_node *json_get_object(struct json_node *n, const char *name)
{
struct json_node **np = json_get_objectp(n, name);
-
+
if (np)
return *np;
return 0;
struct json_node *json_detach_object(struct json_node *n, const char *name)
{
struct json_node **np = json_get_objectp(n, name);
-
+
if (np)
{
struct json_node *n = *np;