What stands out in jq
An exported reading list is often a JSON object with account metadata wrapped around the useful entries. jq lets you peel away those layers without pasting a private export into an online formatter. The most helpful habit is to inspect the shape at each stage before adding another filter.
Walkthrough
- Download reading.json and run jq keys reading.json. The top-level object has a single key named items. Run jq '.items | length' reading.json in Bash or PowerShell. The result should be 3. This catches the common mistake of treating the wrapper itself as an array.
- Run the filter shown below. The brackets after items emit one item at a time. select keeps items whose saved property is true. The last stage reads the title only after the selection, while the rest of the object is still available to the filter.
- Look at the two resulting lines. They are plain text because -r requests raw strings. If the next program expects a JSON array, use the second filter instead. Its brackets collect the results back into one JSON value.
- Compare the result with the actual three records. A legitimate title includes a comma, so splitting the text by punctuation would introduce an extra title. Choose one-title-per-line output for a person and the JSON array for another program.
jq -r '.items[] | select(.saved == true) | .title' reading.jsonjq '[.items[] | select(.saved == true) | .title]' reading.jsonField tip
When borrowing a filter for your own export, check the type of the saved flag. The string "true" and the Boolean true are different JSON values. Inspect one whole record before changing the predicate or blaming the file.
Where it falls short
Raw lines are inconvenient for titles that contain line breaks. Keep the JSON structure when passing text between applications that need to reconstruct the exact titles.
Try it yourself
Change the third record's saved flag in a working copy and rerun both filters. The line-oriented version should now have three titles. The array should still be a single JSON value containing three elements. That difference is the point of the exercise.