add write_json_line function