Serialize new formatter#83
Conversation
* Rename JSONOutputter -> JSONWriter * Change all unittests in serializer to remove spacing * Switch to using iopipe writeBuf function with default ReleaseOnWrite = true * Update unittests in formatter.d to use ReleaseOnWrite.no to keep the output in the window * Move jsonEscapeSubstitutions into formatter * Add JSONWriterInterface and JSONWriterObject to to allow virtual functions to user JSON writer types. * default serializer now has NO spacing in the output, use an appropriate formatter to make pretty-printed json. More options to be determined.
|
@Inkrementator wondering if you have some thoughts on this as a user with current code. While redoing the serializer, there are some breaking changes here:
Also value your feedback @gulugulubing! I had some inclination to give back a delegate for some kind of scoped value writing for the virtual function setup, but after implementing it for a bit, I did not like how it worked. Ideas on how to solve that problem welcome. |
|
It looks good to me. It's much more symmetric with the deserialization side (Tokenizer for input ↔ Writer for output). One minor thing — in serialize.d around the JSONValue Bool case, it looks like there might be a double-write. I fixed here #85 |
Use the new formatter system to do serialization