I want to know what Content-Type to set for JSON lines (http://jsonlines.org/)?
I tried searching. Its not really application/json as the entire content is not JSON (each line is).
Thanks
text/plain was typically used for JSON, but according to IANA, the official MIME type for JSON is application/json .
A JSONL file is a JSON file created in the JSON Lines format. It contains plain text used to describe structured data. JSONL files are used primarily to stream structured data that should be processed one record at a time.
A media type (also known as a Multipurpose Internet Mail Extensions or MIME type) indicates the nature and format of a document, file, or assortment of bytes. MIME types are defined and standardized in IETF's RFC 6838.
As per https://github.com/wardi/jsonlines/issues/9, there is no official mime type, but a convention of application/x-ndjson. Or application/x-jsonlines. Note that this issue has been sitting there since 2015, which might suggest that jsonlines is not exactly catching fire.
JSON lines is supported by some AWS services and they use application/jsonlines
content type.
I have the server return text/plain; charset=utf8
for JSON Lines files. As @bmargulies says, application/x-ndjson
has limited support. At least with text/plain
users can see the data in their browser (rather than being shown a download/save as dialog). Setting the charset explicitly prevents random "corruption" by (un)helpful user agents.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With