diff options
-rw-r--r-- | CMakeLists.txt | 2 | ||||
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | reformatter/json_reformat.c | 4 | ||||
-rw-r--r-- | src/yajl_gen.c | 4 |
4 files changed, 14 insertions, 1 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index b38b1a8..c0611a2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -18,7 +18,7 @@ PROJECT(YetAnotherJSONParser C) SET (YAJL_MAJOR 2) SET (YAJL_MINOR 0) -SET (YAJL_MICRO 3) +SET (YAJL_MICRO 4) SET (YAJL_DIST_NAME "yajl-${YAJL_MAJOR}.${YAJL_MINOR}.${YAJL_MICRO}") @@ -1,5 +1,10 @@ +2.0.4 + + 2.0.3 * John Stamp generation of a pkgconfig file at build time. + * @robzuber bugfix in yajl_tree_get() + * @lloyd - fix for compilation on 64 bit windows 2.0.2 * lth fix typos in yajl_tree.h macros YAJL_IS_INTEGER and YAJL_IS_DOUBLE, diff --git a/reformatter/json_reformat.c b/reformatter/json_reformat.c index c5b88f0..ce77c11 100644 --- a/reformatter/json_reformat.c +++ b/reformatter/json_reformat.c @@ -99,6 +99,7 @@ usage(const char * progname) "usage: json_reformat [options]\n" " -m minimize json rather than beautify (default)\n" " -u allow invalid UTF8 inside strings during parsing\n", + " -e escape any forward slashes (for embedding in HTML)\n", progname); exit(1); @@ -136,6 +137,9 @@ main(int argc, char ** argv) case 'u': yajl_config(hand, yajl_dont_validate_strings, 1); break; + case 'e': + yajl_gen_config(g, yajl_gen_escape_solidus, 1); + break; default: fprintf(stderr, "unrecognized option: '%c'\n\n", argv[a][i]); diff --git a/src/yajl_gen.c b/src/yajl_gen.c index 8605982..f36da2a 100644 --- a/src/yajl_gen.c +++ b/src/yajl_gen.c @@ -57,6 +57,7 @@ yajl_gen_config(yajl_gen g, yajl_gen_option opt, ...) switch(opt) { case yajl_gen_beautify: case yajl_gen_validate_utf8: + case yajl_gen_escape_solidus: if (va_arg(ap, int)) g->flags |= opt; else g->flags &= ~opt; break; @@ -222,6 +223,9 @@ yajl_gen_double(yajl_gen g, double number) if (isnan(number) || isinf(number)) return yajl_gen_invalid_number; INSERT_SEP; INSERT_WHITESPACE; sprintf(i, "%.20g", number); + if (strspn(i, "0123456789-") == strlen(i)) { + strcat(i, ".0"); + } g->print(g->ctx, i, (unsigned int)strlen(i)); APPENDED_ATOM; FINAL_NEWLINE; |