Google Groups

Re: [json-schema] About the latest JSON Pointer draft: the role of the caret ('^')


Gary Court Apr 12, 2012 3:57 PM
Posted in group: JSON Schema
On Thu, Apr 12, 2012 at 4:40 PM, Francis Galiegue <fgal...@gmail.com> wrote:
> On Thu, Apr 12, 2012 at 23:00, Gary Court <gary....@gmail.com> wrote:
>> Using the carat "^" character code for escaping is a bad idea,
>> especially when the intent is to use JSON Pointers in URIs. This is
>> because this character code is not a valid URI character key, and will
>> be escaped by any RFC compliant URI parsing library. Example:
>>
>> URI.normalize("#/^/foo/bar") == "#/%5E/foo/bar"
>>
>> I propose JSON Pointer use URI component escaping rules for handling
>> property name delimiters. Example:
>>
>> {"/foo":{"bar":true}}
>>
>> becomes:
>>
>> #/%2Ffoo/bar
>>
>> This will make JSON Pointer URI compliant, and follows the same
>> reasoning why JSON Pointer was switched to use "/" instead of "." for
>> a delimiter.
>>
>> --Gary
>>
>
> Section 1: "This syntax is intended to be easily expressed in JSON
> string values and Uniform Resource Identifier (URI) [RFC3986] fragment
> identifiers."
>
> How is this a problem at all? AFAICS, the spec does not mandate
> anywhere that the input string should be URL-encoded, or JSON-encoded,
> or whatever.
>

No, but the spec DOES mandates that it must be "carat encoded". I
don't believe a new escaping mechanism needs to be introduced when an
existing one can be used.

--Gary