It looks like you're returning a Rows object, which of course is just going to provide the fields of each record. If you need a custom schema, you will have to generate that yourself. You can loop through the Rows and convert each record to the structure required. You can then pass that to generic.json or convert to JSON directly.
Anthony On Sunday, April 17, 2016 at 2:19:39 PM UTC-4, Raphael Lechner wrote: > > Hi, > > I'm trying to build an application with ember.js as frontend and web2py as > backend. Ember requires a valid json:api (http://jsonapi.org/) interface. > I tried to use the generic json view but the output is different. > > Example output from generic json view: > {"data": [{ > "name": "100", > "filename": > "pictures.picture_file.8dd3626ec0b3a290.494d475f32303135303532365f3130353432342e6a7067_print.jpg", > "id": 1 > }, > { > "name": "101", > "filename": > "pictures.picture_file.8e48a177244f1ea9.494d475f32303135303532365f3130353435302e6a7067_print.jpg", > "id": 2} > ]} > > Valid json:api output: > {"data": [{ > "id": "100", > "type": "picture", > "attributes": { > "name": "100", > "filename": > "pictures.picture_file.8dd3626ec0b3a290.494d475f32303135303532365f3130353432342e6a7067_print.jpg", > } > }, > { > "id": "101", > "type": "picture", > "attributes": { > "name": "101", > "filename": > "pictures.picture_file.8dd3626ec0b3a290.494d475f32303135303532365f3130353432342e6a7067_print.jpg", > } > } > ]} > > Is there a way to change the schema of the json output? > > Thanks! > Raphael > -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.

