moved json_writer to worker to be thread safe