use `end_json` to end streaming when in streaming mode in addition
to `end_stream`