/*
- * Copyright (C) 2013 Jo-Philipp Wich <jow@openwrt.org>
+ * Copyright (C) 2013-2014 Jo-Philipp Wich <jow@openwrt.org>
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
else
{
list_for_each_entry(item, matches, list)
- printf("%s\n", json_object_to_json_string(item->jsobj));
+ {
+ switch (json_object_get_type(item->jsobj))
+ {
+ case json_type_object:
+ case json_type_array:
+ case json_type_boolean:
+ case json_type_int:
+ case json_type_double:
+ printf("%s\n", json_object_to_json_string(item->jsobj));
+ break;
+
+ case json_type_string:
+ printf("%s\n", json_object_get_string(item->jsobj));
+ break;
+
+ case json_type_null:
+ break;
+ }
+ }
}
}
if (!state || state->error)
{
- fprintf(stderr, "In expression '%s': %s\n",
- expr, state ? state->error : "Out of memory");
+ fprintf(stderr, "Syntax error near {%s}: %s\n",
+ state ? expr + state->erroff : expr,
+ state ? state->error : "Out of memory");
goto out;
}