I thought that it might be useful for other people to learn how to become a power user with their LLN exports until the Anki export feature is more customizable!
This will require a small amount of using your operating system's terminal; I can help you if you have a Windows system, but this is written assuming you're using a Mac or Linux.
Download the JSON file of your vocabulary from LLN. (Saved Items → Export → JSON). It should be somewhere accessible and named something like lln_12345678.ndjson
.
Open your terminal and install jq
.
<aside> 💡 If you're on a Mac, you'll need Homebrew as well; on Windows, Chocolatey.
</aside>
Determine what fields you want from the JSON - see the Appendix below for a list of all the possible fields.
The fields I care about are word
, wordTranslit
, wordDefinition
, and subtitle
.
Determine the order that you would like the columns to be printed in. For example, my columns are Hanzi, Pinyin, English, and Example; you can re-map them when importing, but it's easier to get it right the first time.
I'll break mine down. All examples here will work on a Mac, and most likely Linux.
cat **{file location}** | jq '.[]|[**{fields you want}**] | @csv' -r > **{file to save}**
This is essentially a flow from left to right: we're reading the file, picking out (and transforming) the fields that you want, and telling jq
that we want to spit it out as a CSV, which Anki gobbles up. This is some pretty heady stuff - you're basically writing an Extract, Transform, Load operation! Let's fill it out, replacing the stuff in brackets (and the brackets themselves).
The file that you downloaded from LLN - if you're on a Mac, that's most likely in your Downloads folder. Using some shorthand, that will look something like:
cat ~/Downloads/lln_json_items_2021-1-4_2667878.ndjson
If you want to learn more about this, go here.
You already have a list of the fields you want - now it's time to extract them using the following format. I'll give an example of what mine looks like.