hi,
i like the current "json node export" format since it seems to me more
natural (in respect to jcr).

regards,
philipp

On 1/22/08, Peter Svensson <[EMAIL PROTECTED]> wrote:
> On Jan 22, 2008 10:08 AM, Bertrand Delacretaz <[EMAIL PROTECTED]>
> wrote:
>
> > Hi,
> >
> > (renaming the thread to attract attention of our JSON folks)
> >
>
> Good idea. Thanks.
>
>
> >
> > On Jan 22, 2008 9:47 AM, Peter Svensson <[EMAIL PROTECTED]> wrote:
> > > ...The json that would be nice to have is something like this;
> > >
> > > {
> > >     label: 'name',
> > >     identifier: 'name',
> > >     items:
> > >     [
> > >         { name:'Fruit', type:'category'},
> > >         { name:'Cinammon', type: 'category',
> > >         children:
> > >         [
> > >         { name:'Cinammon Roll', type:'poptart' },
> > >         { name:'Brown Sugar Cinnamon', type:'poptart' },
> > >         { name:'French Toast', type:'poptart' }
> > >         ]
> > >         },
> > >         { name:'Chocolate', type: 'category'}
> > >     ]
> > > }
> > >
> > > Where the only important stuff here is that child nodes should be put in
> > a
> > > separate array [], not as an object  to the parent node, like this;
> >
> > ...(snipped current format)
> >
> > Ok, so basically you'd like the child nodes to be in an array named
> > "children".
> >
> > I know others on this list have more javascript experience than me,
> > what do people think?
> >
> > > ....Also, I have difficulties understanding what to do with the
> > >
> > > "testing":
> > >            {"jcr:primaryType":"nt:unstructured",
> > >
> > > part, since I would somehow like it to be like this;
> > >
> > > children:
> > > [
> > >           {
> > >                   title: 'testing',
> > >                   jcr_primaryType: 'nt:unstructured',
> > >                   children:
> > >                   [
> > >                               { title:"test2", sling_resourceType:
> > > "usling/example", jcr_primaryType: "nt:unstructured", text: "Default
> > text of
> > > the test node"},
> > >                                ....
> > >                   ]
> > >           }
> > > ]
> > >
> > > Hmm. I really think that this would be the correct translation, now that
> > > I've printed it out. The problem was in choosing how to remove the
> > current
> > > "name: {}" structure to move the name into the object (where it is
> > anyway),
> > > like children: [{title: name....}]...
> >
> > Ok, I agree that the above is more immediately understandable than the
> > current format.
> >
> > The downside, iiuc, is that if forces the use of ".children." to
> > access children...well, not sure if that's a downside, let's hear what
> > other javascript aficionados think!
> >
>
> Well, I think its OK. Children would refer to an array of object, and each
> object could have another children property which had an array as value, so
> I don't think it would be a problem (from a purely js perspective)
>
>
> >
> > > ...Note that children is just a convenient name, and doesn't mean
> > anything
> > > magic. Also, I would feel very much more comfortable not having quotes
> > > around property names. I understand that they're there to escape the ':'
> > ,
> > > which are very magic in js and separates property names from values,
> > > therefore I replaced them with underscores....
> >
> > IIUC, the goal with removing the quotes is only to make the JSON look
> > nicer, is that right?
> >
>
> Argh! You got me there :). I'm just used to not having any quotes on
> property names, but I'd have to google to know if there's any difference, so
> for now, yes only to look nice - and I agree that it's not a good thing to
> have the name change, depending on platform.
>
>
> >
> > The problem with transforming sling:resourceType to sling_resourceType
> > in JSON is the possible confusion in documentation and in people's
> > minds...I don't like that too much.
> >
> > As you indicate, making other JSON renditions pluggable would be easy,
> > but I think we should be able to agree on a good enough default
> > format.
> >
> > -Bertrand
> >
>

Reply via email to