{"html_url": "https://github.com/simonw/sqlite-utils/issues/417#issuecomment-1079441621", "issue_url": "https://api.github.com/repos/simonw/sqlite-utils/issues/417", "id": 1079441621, "node_id": "IC_kwDOCGYnMM5AVvjV", "user": {"value": 9599, "label": "simonw"}, "created_at": "2022-03-25T21:18:37Z", "updated_at": "2022-03-25T21:18:37Z", "author_association": "OWNER", "body": "Updated documentation: https://sqlite-utils.datasette.io/en/latest/cli.html#inserting-newline-delimited-json", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 1175744654, "label": "insert fails on JSONL with whitespace"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/sqlite-utils/issues/417#issuecomment-1074256603", "issue_url": "https://api.github.com/repos/simonw/sqlite-utils/issues/417", "id": 1074256603, "node_id": "IC_kwDOCGYnMM5AB9rb", "user": {"value": 9954, "label": "blaine"}, "created_at": "2022-03-21T18:19:41Z", "updated_at": "2022-03-21T18:19:41Z", "author_association": "NONE", "body": "That makes sense; just a little hint that points folks towards doing the right thing might be helpful!\r\n\r\nfwiw, the reason I was using jq in the first place was just a quick way to extract one attribute from an actual JSON array. When I initially imported it, I got a table with a bunch of embedded JSON values, rather than a native table, because each array entry had two attributes, one with the data I _actually_ wanted. Not sure how common a use-case this is, though (and easily fixed, aside from the jq weirdness!)", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 1175744654, "label": "insert fails on JSONL with whitespace"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/sqlite-utils/issues/417#issuecomment-1074243540", "issue_url": "https://api.github.com/repos/simonw/sqlite-utils/issues/417", "id": 1074243540, "node_id": "IC_kwDOCGYnMM5AB6fU", "user": {"value": 9599, "label": "simonw"}, "created_at": "2022-03-21T18:08:03Z", "updated_at": "2022-03-21T18:08:03Z", "author_association": "OWNER", "body": "I've not really thought about standards as much here as I should. It looks like there are two competing specs for newline-delimited JSON!\r\n\r\nhttp://ndjson.org/ is the one I've been using in `sqlite-utils` - and https://github.com/ndjson/ndjson-spec#31-serialization says:\r\n\r\n> The JSON texts MUST NOT contain newlines or carriage returns.\r\n\r\nhttps://jsonlines.org/ is the other one. It is slightly less clear, but it does say this:\r\n\r\n> 2. Each Line is a Valid JSON Value\r\n>\r\n> The most common values will be objects or arrays, but any JSON value is permitted.\r\n\r\nMy interpretation of both of these is that newlines in the middle of a JSON object shouldn't be allowed.\r\n\r\nSo what's `jq` doing here? It looks to me like that `jq` format is its own thing - it's not actually compatible with either of those two loose specs described above.\r\n\r\nThe `jq` docs seem to call this \"whitespace-separated JSON\": https://stedolan.github.io/jq/manual/v1.6/#Invokingjq\r\n\r\nThe thing I like about newline-delimited JSON is that it's really trivial to parse - loop through each line, run it through `json.loads()` and that's it. No need to try and unwrap JSON objects that might span multiple lines.\r\n\r\nUnless someone has written a robust Python implementation of a `jq`-compatible whitespace-separated JSON parser, I'm inclined to leave this as is. I'd be fine adding some documentation that helps point people towards `jq -c` though.", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 1175744654, "label": "insert fails on JSONL with whitespace"}, "performed_via_github_app": null}