[TYPO3-mvc] Making JSON data from object

Roland most.wanted at gmx.at
Fri Nov 16 11:05:02 CET 2012


hi claus,

thanks for your comprehensive explanation - works like a charm! :-)

one thing i noticed: reflexive associations in domain model objects 
result to this:

{
     "uid": 1,
     "name": "Product 001",
     "categories": [
         {
             "uid": 4
         },
         {
             "uid": 7
         }
     ],
     "accessories": [
         {
             "uid": 8,
             "name": "Product 008",
             "zubehoer": []
         },
         {
             "uid": 12,
             "name": "Product 012",
             "zubehoer": []
         }
     ]
}

this represents one "Product". "Categories" are represented only by 
their uid but "Accessories" are represented by all their attributes. 
"Accessories" are also "Products" - so there is a reflexive association 
from "Product" to "Product".

maybe this would be enough:

{
     "uid": 1,
     "name": "Product 001",
     "categories": [
         {
             "uid": 4
         },
         {
             "uid": 7
         }
     ],
     "accessories": [
         {
             "uid": 8
         },
         {
             "uid": 12
         }
     ]
}

What do you think?

kind regards

roland


More information about the TYPO3-project-typo3v4mvc mailing list