json-lines
json-lines copied to clipboard
Document how to embed newlines
The JSON I'd like to store as jsonl has linefeeds (one of the fields is a block of mardown text).
Is there special way to encode this? I'm not seeing any examples, here or on other sites.
will this work?
{"message": "hello
world"}
Here are related comments found online.
https://community.snowflake.com/s/article/Escaping-new-line-character-in-JSON-to-avoid-data-loading-errors https://www.geeksforgeeks.org/how-to-handle-newlines-in-json/
And this discussion goes into some good detail...
https://github.com/wardi/jsonlines/issues/35
Basically, the newlines within JSON should already be represented as textual \n sequences, rather than the newline ASCII characters that delimit each full record. If your source JSON hasn't done this, it possibly means that it wasn't encoded to JSON correctly. If you open it up in a plain-text editor, do you see \n or a real line break?