Re: [Jsonpath] JSONPath or JMESPath

Davide Bettio <davide.bettio@ispirata.com> Wed, 12 August 2020 10:57 UTC

Return-Path: <davide.bettio@ispirata.com>
X-Original-To: jsonpath@ietfa.amsl.com
Delivered-To: jsonpath@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id CB8473A1218 for <jsonpath@ietfa.amsl.com>; Wed, 12 Aug 2020 03:57:32 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.099
X-Spam-Level:
X-Spam-Status: No, score=-2.099 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (2048-bit key) header.d=ispirata.com
Received: from mail.ietf.org ([4.31.198.44]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 4B3M9NaL2-8P for <jsonpath@ietfa.amsl.com>; Wed, 12 Aug 2020 03:57:31 -0700 (PDT)
Received: from mail-wm1-x330.google.com (mail-wm1-x330.google.com [IPv6:2a00:1450:4864:20::330]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 811583A1216 for <jsonpath@ietf.org>; Wed, 12 Aug 2020 03:57:31 -0700 (PDT)
Received: by mail-wm1-x330.google.com with SMTP id c19so3975880wmd.1 for <jsonpath@ietf.org>; Wed, 12 Aug 2020 03:57:31 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ispirata.com; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=31j0x/MoA0jVO0KAbVwnxEWmPu5woQ0ennY+Vj1n9CM=; b=BYi1lUZMCSJ2CuzIcatpGfXn66tlUUxm8dnrL5Cf+7C2bZwlAc9ETuRMJ+b1OFTS2H BXE+y4UIYHZx4+RI6/i2hPzvfIeY3uxAXGWxCptUQOSoGrq1UbM1qM9YFUVEKj3Dzg6c 1Y+gD+1P9ug1jGTU4EPTjrWZ5VyuRAe/jhmslqKoe8KyOlxAUYh/+79yspGCr4KhLp8U UjDeyTHabcYEQff3dNv849LyTd/6fpifI0/0N2jIedG/IQJMlgPicYf/2lbFNttle0Ew CHISmTupVKR6cfyV+5CVCqrCy7TvM+kkrFuvdwHoRirRcPYcZ/rdKix/Xok6YwYEBytZ mOtw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=31j0x/MoA0jVO0KAbVwnxEWmPu5woQ0ennY+Vj1n9CM=; b=ItoCSIsdzcGo5faSeOZ75JiNyyMYwE6ccJuj/nivlHIVFj8rlq2aid6PP14ZNDbzJW rSSPF9Gh3809IeElP2EbFpbHXpxQgr28535GGiNZHgFKR+4B74HnnhTmMJzLnJ3BwlNi u920EtUtjH6yK/ZM6PNX+SgDIYKcjC62RenwaQcMi3jdna/CW04Kek9HD4P9lVwZGzPy fa2XfsN9k6XdGnPPFK0AyXLKuNuGBwgPDWY81fNJZAA8i07UVPBjjB02eEs+5R+nziYb k/IK2VL0wlA4yjYhACKN/6WtyX7JRRJskQZMnUww6nhbDpt+uCa0iL5CJxIMjo0hP7Pm VthA==
X-Gm-Message-State: AOAM532hJMmKztnl3ev63EgoSwXQGghbb4Gq2iObcnu6i4dRIsiBtpEY rgVZQnqviwhclLI3yKiwoKA5sTha1bR4nvH4o3Tv1eKnnEA=
X-Google-Smtp-Source: ABdhPJz+/QrT9VofTi8sIh5idMiEBWNrLsuw6dj2I4N4vhCq94viXRcH7lK+yxDhRtRiXUsiKaCAZP0afH8OSLJmvwI=
X-Received: by 2002:a1c:4e0c:: with SMTP id g12mr8021726wmh.136.1597229849835; Wed, 12 Aug 2020 03:57:29 -0700 (PDT)
MIME-Version: 1.0
References: <CAAWU5L7PtaFsLd=cXthzDLvr89Va=tCLN04xk2O8VA8Gom5UDw@mail.gmail.com> <C5A814CE-888E-427F-85F2-45C846174353@tzi.org>
In-Reply-To: <C5A814CE-888E-427F-85F2-45C846174353@tzi.org>
From: Davide Bettio <davide.bettio@ispirata.com>
Date: Wed, 12 Aug 2020 12:56:54 +0200
Message-ID: <CAAWU5L7KjbgG6-e98MVion5cwDkJ=NTsQgs5ZdFMf6wcyUd3kg@mail.gmail.com>
To: Carsten Bormann <cabo@tzi.org>
Cc: jsonpath@ietf.org
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Archived-At: <https://mailarchive.ietf.org/arch/msg/jsonpath/lyPCsFX3EkWQu518MyKcFASU3Yc>
Subject: Re: [Jsonpath] JSONPath or JMESPath
X-BeenThere: jsonpath@ietf.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: A summary description of the list to be included in the table on this page <jsonpath.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/jsonpath>, <mailto:jsonpath-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/jsonpath/>
List-Post: <mailto:jsonpath@ietf.org>
List-Help: <mailto:jsonpath-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/jsonpath>, <mailto:jsonpath-request@ietf.org?subject=subscribe>
X-List-Received-Date: Wed, 12 Aug 2020 10:57:33 -0000

Hello,

On  20200811, at 18:30, Carsten Bormann <cabo@tzi.org> wrote:
> Sure.  So what are the advantages of JMESPath over JSONPath that are not about what we’ve set out to do here?

The main  difference I found so far is that JMESPath supports
functions, which is IMHO an useful feature, however there are 2 major
drawbacks:
- Increased implementation complexity compared to JSONPath (my Elixir
JSONPath implementation counts a few hundred lines of code).
- JMESPath expressions might be computational heavier, since it has
support for functions such as sort, avg, map, etc... that might be
expensive on huge datasets.

In my opinion the right balance between powerfulness and enabling
simple implementations has been so far one of the key factors that
made JSONPath popular over other alternatives, even if it lacks
support for aggregation functions.

I also realize that exists a kind of hierarchy between existing
competing solutions, and each one has valid use cases:
JSONPointer: no computation (hence deterministic processing time),
returns just a subtree
JSONPath: allows filtering and projections, however the result is
still a subset of the original dataset
JMESPath: allows computations (some of them expensive), and the output
value might not exist in the original JSON object

At the moment JSONPointer and JMESPath have complete specs, while
JSONPath doesn't.

Regards,
Davide Bettio.