Why not?
Petri
I actually found this behavior of adding a newline undesirable myself.
I want to have control of that newline for logging and formatting
purposes.
Regards,
Ryan
Well, I must admit that it's easier for the user to add a newline than
to remove it after encoding. But when pretty printing (i.e. having
JSON_INDENT(x) where x > 0 in flags), I would keep the trailing
newline.
I revised the whitespace usage in the encoder. The following commit
was applied to master. Among other things, it removes the trailing
newline, whatever the value of flags is.
commit f236c14dc5457a41119492ebce41b8920fd31f65
Author: Petri Lehtinen <pe...@digip.org>
Date: Wed Nov 4 21:24:22 2009 +0200
dump: Revise whitespace usage
- Never append newline to output
- By default, add spaces between array and object items for more
readable output
- Introduce the flag JSON_COMPACT to not add the aforementioned spaces
doc/apiref.rst | 24 +++++-
src/dump.c | 40 ++++++----
src/jansson.h | 1 +
test/.gitignore | 1 +
test/testprogs/Makefile.am | 3 +-
test/testprogs/test_dump.c | 174 ++++++++++++++++++++++++++++++++++++++++++++
6 files changed, 221 insertions(+), 22 deletions(-)