Re: deJSONKit - serialization as JSON from E
Tyler Close <[email protected]>
| Newsgroups | gmane.comp.lang.e.general |
|---|---|
| Message-ID | <[email protected]> |
On Fri, May 22, 2009 at 10:11 AM, Kevin Reid <[email protected]> wrote: > On May 22, 2009, at 12:20, Tyler Close wrote: >> On Fri, May 22, 2009 at 4:02 AM, Kevin Reid <[email protected]> wrote: >>> >> >>> Right, but there's no syntax to bind (define) #s=1234 within the >>> JSON. >> >> The fragment is not making a deep reference into the JSON text; it's >> referring to the resource as a whole. Perhaps the following example >> will be clearer: >> >> resource at: <http://example.com/foo.json>: >> >> { >> "name" : "I am recursive", >> "self": { "@" : "http://example.com/foo.json" } >> } >> >> Which a client can reconstruct into a JSON container having 2 members: >> one with a text string value and another with a reference to the JSON >> container. > > But this permits only reference back to the root, not arbitrary > internal cycles. I need something that can encode, for an arbitrary > well-known example, a doubly-linked list. A doubly-linked list would be represented by multiple JSON documents. For example, for the list [ a, b, c ]: @ <http://example.com/1>: { "value" : "a", "next" : { "@" : "2" } } @ <http://example.com/2>: { "value" : "b", "previous" : { "@" : "1" }, "next" : { "@" : "3" } } @ <http://example.com/3>: { "value" : "c", "previous" : { "@" : "2" } } Reassembly of arbitrarily complex circular graphs comes for free once you've implemented promises. --Tyler -- "Waterken News: Capability security on the Web" http://waterken.sourceforge.net/recent.html