diff options
author | Jo-Philipp Wich <jow@openwrt.org> | 2014-01-06 11:55:44 +0000 |
---|---|---|
committer | Jo-Philipp Wich <jow@openwrt.org> | 2014-01-06 11:59:17 +0000 |
commit | f1e3aeb2526ea28db34c7bc714277c1dff26e5fc (patch) | |
tree | ba2abc29aceae4c8a08a16ce31bacfe4a80868b6 | |
parent | 325454c60f282994cf79c69d49edbcea53f2e924 (diff) | |
download | jsonpath-f1e3aeb2526ea28db34c7bc714277c1dff26e5fc.tar.gz |
cli: supress printing "null" in non-export mode, output strings unescaped
-rw-r--r-- | main.c | 20 |
1 files changed, 19 insertions, 1 deletions
@@ -179,7 +179,25 @@ export_value(struct list_head *matches, const char *prefix) 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; + } + } } } |