Subject: Re: [Jsonpath] Fields?

From: Daniel P <[email-masked]>
Date: Fri, 9 Oct 2020 15:52:01 -0400

On Fri, Oct 9, 2020 at 3:00 PM <[email-masked]> wrote:
>
> Charter: https://datatracker.ietf.org/doc/charter-ietf-jsonpath/
>
> JSONPath is a syntax, originally based on the XML "XPath" design,
> which selects fields and values from a JSON document.

What is meant by "fields"? That term isn't mentioned in ECMA-404.
JSONPath selects JSON values, and only JSON values.

Daniel

---

From: Carsten Bormann <[email-masked]>
Date: Fri, 9 Oct 2020 22:11:15 +0200

Hi Daniel,

> On 2020-10-09, at 21:52, Daniel P <[email-masked]> wrote:
> 
> What is meant by "fields”?

Field is a Java term for what is called member in RFC 8259 (and, with a bit more nuance, in C++, and a lot of other places).  (ECMA 262 defines field as the entry in its abstract Record type, which is similar.)

> That term isn't mentioned in ECMA-404.

Well, ECMA-404 doesn’t bother explaining what the syntax it specifies is supposed to mean, so it doesn’t have a lot of use for terms like “member” or “field”.

> JSONPath selects JSON values, and only JSON values.

We could argue whether JSONPath only selects the value or maybe also the position of the value in the tree.  The latter is useful, for instance, for then replacing the value at that position with a different value.

Grüße, Carsten

---

From: Daniel P <[email-masked]>
Date: Fri, 9 Oct 2020 17:04:47 -0400

> On Fri, Oct 9, 2020 at 4:11 PM Carsten Bormann <[email-masked]> wrote:
> Field is a Java term for what is called member in RFC 8259 (and, with a bit more nuance, in C++, and a lot of other places).
> (ECMA 262 defines field as the entry in its abstract Record type, which is similar.)
>
> Well, ECMA-404 doesn’t bother explaining what the syntax it specifies is
> supposed to mean, so it doesn’t have a lot of use for terms
> like “member” or “field”.
>
ECMA-404 uses "name/value pair", which is what I understand the term
"member" to mean (Douglas Crockford uses "member").

> We could argue whether JSONPath only selects the value or maybe also the
> position of the value in the tree.

Yes, assuming by position you mean a normalized JSONPath expression,
as an alternative to returning values.

But regarding "members" or "name/value pairs", no JSONPath query
returns these except as parts of a JSON object, which is a JSON value.
It's not like XQuery which can return results that are not an XML document.

It seems to me that "selects JSON values from a JSON document", or if you like,
"selects JSON values or alternatively normalized JSONPath expressions", would
suffice.

Daniel

---

From: Tim Bray <[email-masked]>
Date: Fri, 9 Oct 2020 14:17:45 -0700

Yeah, I think the "fields and values" language survives from my first
draft, and when I reread it today I wondered why I had written that. Anyhow
I don't think it's a problem in a practical sense.

On Fri., Oct. 9, 2020, 2:05 p.m. Daniel P, <[email-masked]> wrote:

> > Field is a Java term for what is called member in RFC 8259 (and, with a
> bit more nuance, in C++, and a lot of other places).
> --
> Jsonpath mailing list
> [email-masked]
> https://www.ietf.org/mailman/listinfo/jsonpath
>