[TYPO3-mvc] Making JSON data from object

Stephen Bungert stephenbungert at yahoo.de
Thu Nov 15 17:25:23 CET 2012


I think you have to make a function to make an array first?!?

When I need to json encode a few model properties for ajax I just used the 
getters of the properties I needed to make  a new array

Stephen


"Roland" <most.wanted at gmx.at> schrieb im Newsbeitrag 
news:mailman.1.1352992153.32190.typo3-project-typo3v4mvc at lists.typo3.org...
> hi everybody,
>
> Am 04.03.10 11:48, schrieb Søren Malling:> I need to create a json string 
> from a repository but (i guess) due to
> > the use of object in the return of findAll() my json output (using
> > json_encode) looks like this
> >
> > [{},{}]
> >
> > I only got 2 results in my object, so the amount of square brackets
> > are correct, but there is no data.
> >
> > What would be the correct to solve this problem? I couldn't find any
> > thing on JSON in the extbase source or from any Google searches?
>
> i have the same problem - any new best practices here?
>
> i tried to use the <fed:data.json /> viewhelper [1], but i also got only 
> empty brackets...
>
> how do you create json from
>
> (a) Tx_Extbase_Persistence_QueryResult
> (b) Tx_YourExtension_Domain_Model_YourObject
>
> kind regards
>
> roland
>
>
> [1] http://fedext.net/fed-viewhelpers/variables/json.html 




More information about the TYPO3-project-typo3v4mvc mailing list