sqlite-utils icon indicating copy to clipboard operation
sqlite-utils copied to clipboard

Doublebyte content is unicode-escaped in JSON output

Open oli opened this issue 1 year ago • 0 comments

test.json

[
    {
        "id": 123,
        "text": "Japanese 日本語"
    },
    {
        "id": 223,
        "text": [
            "Japanese 日本語"
        ]
    }
]

Import

sqlite-utils insert test.db text test.json --pk=id

Query using sqlite-utils

sqlite-utils test.db "select * from text"
[{"id": 123, "text": "Japanese \u65e5\u672c\u8a9e"},
 {"id": 223, "text": "[\"Japanese \u65e5\u672c\u8a9e\"]"}]

sqlite-utils test.db "select * from text" --csv
id,text
123,Japanese 日本語
223,"[""Japanese 日本語""]"

I assume this is something to do with “ensure ascii” for JSON, but is there any way I can get non-escaped content strings in sqlite-utils JSON output? Thanks!

oli avatar Apr 03 '24 13:04 oli