Return-Path: X-Original-To: notmuch@notmuchmail.org Delivered-To: notmuch@notmuchmail.org Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id 489D8429E25 for ; Sat, 10 Dec 2011 10:32:24 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: -0.799 X-Spam-Level: X-Spam-Status: No, score=-0.799 tagged_above=-999 required=5 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled Received: from olra.theworths.org ([127.0.0.1]) by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id eyLLcz-Ivwa4 for ; Sat, 10 Dec 2011 10:32:24 -0800 (PST) Received: from mail-gx0-f181.google.com (mail-gx0-f181.google.com [209.85.161.181]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client certificate requested) by olra.theworths.org (Postfix) with ESMTPS id E4FE2431FB6 for ; Sat, 10 Dec 2011 10:32:23 -0800 (PST) Received: by ggnr1 with SMTP id r1so5213218ggn.26 for ; Sat, 10 Dec 2011 10:32:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; bh=aO31lsGX1a+4Y3rrTY0eOenUiZO02bs0mf6PJWgIQX8=; b=IzMF/s1hUYIXDDiheFO9tqLF5H36HOc/dZ88Xtcg5gKdCNefdcgASmb4FZMzZKKB+M CX1etm7K20CM7Y1wraPeX0Yx1WwgVe/0ZrR8uVPAMfrcZml5a4TZrVUmRwhCD5iHQrSS VPsMwA2OlRJkZl0D4UHXLsXN6wwCz/kH2PtUQ= MIME-Version: 1.0 Received: by 10.182.145.99 with SMTP id st3mr1527602obb.69.1323541942419; Sat, 10 Dec 2011 10:32:22 -0800 (PST) Received: by 10.182.222.35 with HTTP; Sat, 10 Dec 2011 10:32:22 -0800 (PST) Date: Sat, 10 Dec 2011 20:32:22 +0200 Message-ID: Subject: Exporting a single email as JSON From: Ciprian Dorin Craciun To: notmuch@notmuchmail.org Content-Type: text/plain; charset=UTF-8 X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Dec 2011 18:32:24 -0000 Hello all! Quick question: why isn't it reasonable to export a **single** email in JSON format (by using the `show` sub-command)? (I mean I understand that in order to be able to correctly parse the output we need only one "object" (i.e. a list of threads, containing a list of emails, etc.). But there might be use cases in which we need a "twist".) My current use case is: I want to import the JSON representation of my emails in CouchDB, each email in a single document. And as I already have my emails indexed with Notmuch, I hopped that -- with the help of some Bash-fu and Curl -- it would have been trivial to instruct notmuch to export all emails matching a certain criteria as JSON... What would have been perfect in this case: each matching email (with or without the `--entire-thread` flag) should be exported as a single JSON object on a single line, thus each different email on a single line. Thus I could have easily used `notmuch show --output=json-line -- {criteria} | xargs -L 1 -- curl {couchdb-magic}`.) For now I'll pre-process the current output in JavaScript. Thanks, Ciprian.