You dont actually need to parse JSON to get a list of ids from calibredb list, you can just do, for example:
Code:
calibredb list --search whatever -f title --separator , | cut -d, -f1 | tail -n +2 | awk -vORS=, '{ print $1 }' | sed 's/,$/\n/'
Or on windows, where none of the unix tools are available, you can just use calibre-debug
Code:
calibredb list --search whatever -f title | calibre-debug -c "import sys; print ','.join(filter(None, [line.partition(' ')[0].strip() for line in sys.stdin][1:]))"
But, I realize this kind of thing is hard for most people, hence calibredb search