# .ndjson MIME Type: application/x-ndjson

> One JSON value per line — the format for streaming records, logs and bulk imports. Also called JSON Lines.

- MIME type: `application/x-ndjson`
- Extensions: .ndjson, .jsonl
- Also seen as: `application/jsonl`
- Content-Type header: `application/x-ndjson`
- Compress in transit: yes

## Good to know

- No type is registered. `application/x-ndjson` is the de facto choice, and it's what Elasticsearch's `_bulk` API asks for. `application/jsonl` also shows up for `.jsonl` files.
- Streaming APIs send one record per line as soon as it's ready. On the client, read the body as a stream, split on newlines and `JSON.parse` each complete line.
- Not the same as `application/json-seq` (RFC 7464), which puts an ASCII record-separator byte (`0x1E`) before each record.

## Server configuration

### nginx (inside the types block in mime.types)

```
application/x-ndjson ndjson jsonl;
```

### Apache (.htaccess or server config)

```
AddType application/x-ndjson .ndjson .jsonl
```

### Express

```
res.set("Content-Type", "application/x-ndjson");
```

### Python

```
import mimetypes

mimetypes.add_type("application/x-ndjson", ".ndjson")
mimetypes.add_type("application/x-ndjson", ".jsonl")
```

### HTML file input

```
<input type="file" accept=".ndjson,.jsonl,application/x-ndjson">
```

## FAQ

### What is the MIME type for .ndjson files?

`application/x-ndjson`. You may also see `application/jsonl`, but `application/x-ndjson` is the one to send. The same type covers .jsonl.

### What Content-Type header should a .ndjson file be served with?

`Content-Type: application/x-ndjson`. It compresses well, so let the server apply gzip or Brotli.

## Related types

- [.json — application/json](https://www.devkult.com/mime/json.md)
- [.csv — text/csv](https://www.devkult.com/mime/csv.md)
- [.parquet — application/vnd.apache.parquet](https://www.devkult.com/mime/parquet.md)

Open the interactive page: https://www.devkult.com/mime/ndjson