Skip to content

Commit a908a92

Browse files
authored
add eol if missing (#2617)
1 parent 5577cf5 commit a908a92

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/datasets/io/json.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,5 +103,7 @@ def _write(
103103
indices=self.dataset._indices if self.dataset._indices is not None else None,
104104
)
105105
json_str = batch.to_pandas().to_json(path_or_buf=None, orient=orient, lines=lines, **to_json_kwargs)
106+
if not json_str.endswith("\n"):
107+
json_str += "\n"
106108
written += file_obj.write(json_str.encode(encoding))
107109
return written

0 commit comments

Comments
 (0)