RE: [apps-discuss] Last Call: <draft-ietf-appsawg-json-pointer-07.txt> (JSON Pointer) to Proposed Standard

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



If we were starting from scratch and defining JSON Pointer again I would argue for distinguishing array indices and object names in the syntax. For instance, prefix an object name with "/" and an array index with ":".

   json-pointer = *segment
   segment = "/" name  /  ":" index
   name = *( unescaped / escaped )
   unescaped = %x00-2E / %x30-39 / %x3B-7D / %x7F-10FFFF
   escaped = "~" ( "0" / "1" / "2" )
   index = "0" / %x31-39 *(%x30-39) / "-"

1. It makes parsing marginally harder: you cannot just split on "/" and unescape each segment.
2. It doesn't make much difference for selecting a value from some JSON, or for finding a spot to insert a new value.
3. It would allow you to automatically create object *or array* ancestors when setting a new value (eg adding 23 at /a:0/b:0 to {} could give {"a":[{"b":[23]}]}).
4. It might encourage better validation of pointers, but that is probably wishful thinking.

But JSON Pointer drafts have used the /{name|index} format for a year. There are a bunch of implementations. The difference is minor in most circumstances. So while I would be happy to change, I am also comfortable staying with the current pointer syntax.


> There's no good reason for it to be that way, is there?

I don't think so.
 
--
James Manger



[Index of Archives]     [IETF Annoucements]     [IETF]     [IP Storage]     [Yosemite News]     [Linux SCTP]     [Linux Newbies]     [Fedora Users]