Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Convert Telegram History result.json file to text
#!/bin/bash
if [[ ! -f "$1" ]]; then
echo "Json file not found"
exit 1
fi
jq -r '
.messages[] |
select(.text != "") |
{date, text: (if .text|type == "array" then (.text[] | select(. != "") | if .|type == "object" then .text else . end) else .text end)} |
"\(.date)\n\(.text)\n"' < "$1"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment