# ValueError: Trailing data

**URL:** <https://support.prodi.gy/t/valueerror-trailing-data/1778>\
**Category:** Uncategorized\
**Tags:** usage, solved\
**Created:** [July 12, 2019, 12:25am UTC](https://support.prodi.gy/t/valueerror-trailing-data/1778 "2019-07-12T00:25:15Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![ines](https://sea2.discourse-cdn.com/flex020/user_avatar/support.prodi.gy/ines/32/3_2.png) [@ines](https://support.prodi.gy/u/ines)\
**Post date:** [July 12, 2019, 1:47pm UTC](https://support.prodi.gy/t/valueerror-trailing-data/1778/4 "2019-07-12T13:47:25Z")

</div>

Ahh okay – that explains a lot! JSONL is newline-delimited JSON, so one record needs to be on one line. (The advantage is that you can read it in line by line, but it also produces very long lines).

It looks like you’ve creared a regular JSON file? So if you name it `.json` or set `--loader json` on the command line, it should be read in as JSON and work as expected.

If you do want JSONL, you’d have to write `'\n'.join([json.dumps(line) for line in your_data])` to your file. Or you can use the helper function we provide in our library [`srsly`](https://github.com/explosion/srsly):

```python
your_data = [{"text": "foo"}, {"text": "bar"}] # whatever your data is

```

```python
import srsly # that's our little serialization library
srsly.write_jsonl("/path/to/file.jsonl", your_data)

```

---

_[View the full topic](https://support.prodi.gy/t/valueerror-trailing-data/1778)._
