json_encoding_default for datetimes; debug output; dont double extend container if flush=False