OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

xdi message

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]


Subject: JSON parse tree serialization



Version 3: Using the context symbol/function itself as the key, and body as the value. This is even less bulky and more human-readable, and I like it better than #1 and #2.
I've added [ ] around the predicate as Markus corrected to indicate that the predicate segment is a list containing one segment.
The object might also be further wrapped, depending on whether we want to allow a bare JSON value as object and if this would be ambiguous or complicated.
[
   [
      {
         "=":"drummond"
      },
      {
         "<":{
            "+":"email"
         }
      },
      {
         "!":"uuid:f81d4fae-7dec-11d0-a765-00a0c91e0001"
      },
      {
         "<<":{
            "$":"string"
         }
      }
   ],
   [
      {
         "<":""
      }
   ],
   "dsr@ex1.com"
]

Compact version:
[[{"=":"drummond"},{"<":{"+":"email"}},{"!":"uuid:f81d4fae-7dec-11d0-a765-00a0c91e0001"},{"<<":{"$":"string"}}],[{"<":""}],"dsr@ex1.com"]

The compact version is only about 1.5x as long (in characters) as the original XDI display format version:
=drummond<+email>!uuid:f81d4fae-7dec-11d0-a765-00a0c91e0001<<$string>>/<>/



Version 4: Instead of object {"cs":"id"} use a list ["cs","id"]. This actually does not save any characters compared to Version 3, and would be more monotonous to read with only square brackets, so I would rather stick with version 3.




On Apr 5, 2013, at 9:08 AM, Joseph Boyle <joseph@planetwork.net> wrote:

This is an example of the kind of parse tree I naturally get from _javascript_ code I'm writing to parse XDI.
It is probably similar to the Java data structures Markus's XDI2 creates from parsing XDI.

If we can simply JSON-serialize a parse tree that is convenient for programmers, then they can simply JSON-deserialize and use it without more complicated parsing steps.


On Apr 4, 2013, at 11:33 PM, Drummond Reed <drummond.reed@xdi.org> wrote:

JSON SERIALIZATION OPTIONS

Today (Thursday) Joseph and Drummond were able to meet and go over new options for the JSON serialization that could be more “developer friendly” by not requiring parsing of the subject/predicate keys in order to build an XDI graph object model (GOM).
Joseph will present an example of what the GOM could look like an how to serialize it.


=drummond<+email>!uuid:f81d4fae-7dec-11d0-a765-00a0c91e0001<<$string>>/<>/


Version 1:  Separate context symbol and identifier

Compact: [[{"cs":"=","id":"drummond"},{"cs":"<","id":{"cs":"+","id":"email"}},{"cs":"!","id":"uuid:f81d4fae-7dec-11d0-a765-00a0c91e0001"},{"cs":"<<","id":{"cs":"$","id":"string"}}],{"cs":"<","id":""},"dsr@ex1.com"]

Formatted:
[
   [
      {
         "cs":"=",
         "id":"drummond"
      },
      {
         "cs":"<",
         "id":{
            "cs":"+",
            "id":"email"
         }
      },
      {
         "cs":"!",
         "id":"uuid:f81d4fae-7dec-11d0-a765-00a0c91e0001"
      },
      {
         "cs":"<<",
         "id":{
            "cs":"$",
            "id":"string"
         }
      }
   ],
   {
      "cs":"<",
      "id":""
   },
   "dsr@ex1.com"
]

Version 2: Bottom-level context symbol - identifier sequence left in one string. Context functions still (usually>) require separate object.

Compact: [["=drummond",{"cs":"<","id":"+email"},"!uuid:f81d4fae-7dec-11d0-a765-00a0c91e0001",{"cs":"<<","id":"$string"}],{"cs":"<"},"dsr@ex1.com"]

Formatted:
[
   [
      "=drummond",
      {
         "cs":"<",
         "id":"+email"
      },
      "!uuid:f81d4fae-7dec-11d0-a765-00a0c91e0001",
      {
         "cs":"<<",
         "id":"$string"
      }
   ],
   {
      "cs":"<"
   },
   "dsr@ex1.com"
]





[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]