Subject: Re: [apps-discuss] json-pointer: "characters that represent an unsigned base-10 integer value"

From: Francis Galiegue <[email-masked]>
Date: Tue, 1 Jan 2013 11:05:23 +0100

On Mon, Dec 31, 2012 at 4:44 PM, Carsten Bormann <[email-masked]> wrote:
> On Dec 31, 2012, at 16:35, James M Snell <[email-masked]> wrote:
>
>>  1+DIGIT with a statement that leading zeros SHOULD not be used and MUST be ignored if they are present when evaluating an array
>
> No, make that "MUST NOT be sent", "MUST be handled as an error" *).
> The other way is the recipe for soup.
>

It is legal in a JSON Object to have a member with name "01", so
forbidding this as a reference token makes such members effectively
unaccessible.

--
Francis Galiegue, [email-masked]
"It seems obvious [...] that at least some 'business intelligence'
tools invest so much intelligence on the business side that they have
nothing left for generating SQL queries" (Stéphane Faroult, in "The
Art of SQL", ISBN 0-596-00894-5)

---

From: Carsten Bormann <[email-masked]>
Date: Tue, 1 Jan 2013 11:52:10 +0100

> forbidding this as a reference token makes such members effectively

That is, of course, correct.

JSON (RFC 4627) makes a difference between arrays and objects (i.e., an array is not an object).
JavaScript, of course, doesn't.  So in a JavaScript array, you might have additional members with keys such as "foo" or the "01" above.
I just don't think these serialize into JSON arrays*).
So my point was that, if you are talking about JSON arrays, the key "01" is bad, and it MUST NOT occur in a JSON pointer for this purpose.

Side note: More generally speaking, I'm a bit unhappy with the current spec language

   o  If the currently referenced value is a JSON object, [...]

   o  If the currently referenced value is a JSON array, [...]

because in JavaScript, I'm sometimes not so sure.

That's one reason why I'd prefer the rules to work fine in an implementation that doesn't make that distinction as much.
(The other one is that I prefer to avoid soup.)

(In an implementation that doesn't quite know whether it is looking at an array, there is still a problem with the key "-".)

Grüße, Carsten

*) try this:

my_object = ["bar"]
my_object[1] = "foo"
my_object["01"] = "baz"

and then serialize my_object (and, look at my_object["01"] and keys(my_object) to verify correct behavior).

---

From: Matthew Morley <[email-masked]>
Date: Tue, 1 Jan 2013 13:47:05 -0500

.

On Mon, Dec 31, 2012 at 10:15 PM, Matthew Morley <[email-masked]> wrote:

> On Mon, Dec 31, 2012 at 10:44 AM, Carsten Bormann <[email-masked]> wrote:
>
>> >  1+DIGIT with a statement that leading zeros SHOULD not be used and
>> MUST be ignored if they are present when evaluating an array
>>
> Stricter wording makes the most sense to me. The behavior should be one of
> non-resolution in the context of an array, which should translate into
> either errors or failure.
>

I wanted to clarify, that I agree with the "MUST be handled as an error"
part only. 1e0 or 1.000 should be allowed as part of the json pointer
string, due to being a potentially valid keys inside an object.

-- 
Matt