-- Go Lists <[email protected]> wrote
(on Wednesday, 21 April 2010, 06:16 PM +0200):
> All right Matthew, but even if the Json object has numeric index, I
> am not sure it will fit JsonRestStore data format requirements
> (array of objetcs instead of object of objects). Don't you think so?
Look at your example:
[
{"prop1":"value1","prop2":"value2", ...},
{"prop1":"value1","prop2":"value2", ...}
]
That's an array of objects. :)
And yes, it will work for JsonRestStore -- I've used such formats
myself.
> >-- Guillaume ORIOL <[email protected]> wrote
> >(on Wednesday, 21 April 2010, 04:08 PM +0200):
> >>As far as I know, dojox.data.JsonRestStore expects to receive
> >>data in the form:
> >>[
> >> {"prop1":"value1", "prop2":"value2", ...},
> >> {"prop1":"value1", "prop2":"value2", ...},
> >> ...
> >>]
> >>
> >>On the server side, I fetch data with a paginator
> >>(Zend_Paginator_Adapter_DbSelect). This paginator implements a
> >>toJson function. But whatever FETCH_MODE is used to get the data, I
> >>get a Json representation like this one:
> >>{
> >> "0": {"prop1":"value1", "prop2":"value2", ...},
> >> "1": {"prop1":"value1", "prop2":"value2", ...},
> >> ...
> >>}
> >>
> >>Is there something obvious I miss or do I have to write my own
> >>implementation of the toJson() function?
> >
> >Honestly, I'd consider that a bug -- numeric indices should be
> >returned
> >as an array, not as an object. Can you file an issue, please?
> >
> >--
> >Matthew Weier O'Phinney
> >Project Lead | [email protected]
> >Zend Framework | http://framework.zend.com/
> >PGP key: http://framework.zend.com/zf-matthew-pgp-key.asc
> >
>
--
Matthew Weier O'Phinney
Project Lead | [email protected]
Zend Framework | http://framework.zend.com/
PGP key: http://framework.zend.com/zf-matthew-pgp-key.asc