Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update loading.mdx to include "jsonl" file loading. #6647

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions docs/source/loading.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,15 @@ JSON files have diverse formats, but we think the most efficient format is to ha
{"a": 4, "b": -5.5, "c": null, "d": true}
```

When each line of the file stands for a JSON object, they can be loaded as "jsonl" files as well:

```py
>>> from datasets import load_dataset
>>> dataset = load_dataset("json", data_files="my_jsonl_file.jsonl")
```

This will load up every line as an entry in the dataset.

Another JSON format you may encounter is a nested field, in which case you'll need to specify the `field` argument as shown in the following:

```py
Expand Down