Subject: Re: [apps-discuss] draft-ietf-appsawg-json-pointer

From: Mark Nottingham <[email-masked]>
Date: Wed, 24 Oct 2012 16:02:27 +1100

[forwarding to the WG]

Hi Stefan,

My .02 - this is really a question about JSON implementation, I think. JSON-Patch is designed to operate upon JSON documents (where this question doesn't come up), not upon Python data structures.

Cheers,

On 24/10/2012, at 3:04 AM, Stefan Kögl <[email-masked]> wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> Dear Working Group,
> 
> I'm the maintainer of python-json-pointer [1], a Python implementation
> of the json-pointer drafts.
> 
> In Python the natural representation of a JSON object is a dictionary.
> One of the differences is that a Python dictionary can have keys of
> different types. I could, for instance, define the following dictionary
> 
> {"1": "a", 1: "b"}
> 
> and try to resolve the pointer /1. I see several possible ways of
> resolving such cases:
> 
> * Ignore any non-string key
> * Fail on non-string keys
> * Interpret both keys as equal and fail according to the following
>  sentence of the current draft:
>  " If a referenced member name is not unique in an object, the member
>    that is referenced is not unique in an object, the member that is
>    referenced is undefined, and evaluation fails (see below). "
> 
> I understand that this problem can not occur in "pure" JSON where keys
> can only be strings, but I assume that also implementations in other
> languages will face the same issue. What is the opinion of the working
> group on this? Maybe it could be addressed in future drafts.
> 
> 
> Best regards,
> 
> Stefan Kögl
> 
> 
> [1] https://github.com/stefankoegl/python-json-pointer
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.11 (GNU/Linux)
> Comment: Using GnuPG with Mozilla - http://www.enigmail.net/
> 
> iEYEARECAAYFAlCGwCUACgkQ638pvJMAJ9BbsQCfYeu9SVDSKE2Z6DBYUKaAl1/b
> Z9gAoLRaMjzBgun8K8Wd3QEic0bYTxaC
> =ttNc
> -----END PGP SIGNATURE-----

--
Mark Nottingham   http://www.mnot.net/

---

From: "Paul C. Bryan" <[email-masked]>
Date: Thu, 25 Oct 2012 16:25:31 -0700

I agree. JSON specifies only strings as member names, so there is no
ambiguity when resolving within an object. This issue boils-down to the
difference between JSON objects and Python dictionaries.

To help answer your question, perhaps I could know more about the Python
JSON library you're using to serialize Python data structures. How will
it handle the case where a key is not a string?

Without knowing this, I would be inclined to fail on non-string keys,
because the data structure is not conforming to the JSON specification.

Paul

On Wed, 2012-10-24 at 16:02 +1100, Mark Nottingham wrote: 

> _______________________________________________
> apps-discuss mailing list
> [email-masked]
> https://www.ietf.org/mailman/listinfo/apps-discuss