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

From: Stefan Kögl <[email-masked]>
Date: Mon, 05 Nov 2012 17:52:03 +0100

Hi,

Thanks for your answers! I'm using Python's built-in JSON library [1]
but the general approach is that my library should work after JSON
deserialization.

Anyway, my intent was mainly to clarify if this was a topic that might
be covered in the spec. I now understand that this is out of scope and
should be decided by each implementation individually.

Thanks,

Stefan

[1] http://docs.python.org/3/library/json.html

On 10/26/2012 01:25 AM, Paul C. Bryan wrote:
> 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:
>> [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] 
>> <mailto:[email-masked]>> wrote:
>> 
> 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
>> 
>> -- Mark Nottingham   http://www.mnot.net/
>> 
>> 
>> 
>> _______________________________________________ apps-discuss 
>> mailing list [email-masked] <mailto:[email-masked]>
>>  https://www.ietf.org/mailman/listinfo/apps-discuss
> 
>