About the json output and the number of results shown.

Mike Kelly pioto at pioto.org
Wed Jan 12 14:39:45 PST 2011


I've had other problems attempting to use the JSON interface recently.
For starters, if I'm simply trying to retrieve a single message, the
interface is rather awkard. I seem to need to do something like:

    my $json = `notmuch show --format=json id:$message_id`;
    my $parsed_json = decode_json($json);
    my $message = $parsed_json->[0][0][0];

And, when I'm doing my search earlier to even find those message ids, I
need to do a check to `notmuch count` first to see if I'll even get any
results, because the 0 result case is not valid JSON.

Of course, any feedback, like "you're doing it wrong" would be helpful.
My script is available at:

    http://git.pioto.org/gitweb?p=pioto-scripts.git;a=blob;f=mail/notmuch-poll.pl;hb=master

-- 
Mike Kelly


More information about the notmuch mailing list