symfony2 - JSON Root Name in Serialized Entity -



symfony2 - JSON Root Name in Serialized Entity -

i'm using fosrestbundle , jmsserializerbundle output json info consumed ember application. utilize built-in adapters of ember-data , json format expected has have root name. current json follows:

{ "user_id": 1 "first": "dan" "email": "dan@email.com" }

ember expects, , want is:

{ "user": { "user_id": 1 "first": "dan" "email": "dan@email.com" } }

user name of entity. i'm pretty sure configuration thing, looking through documentation can't seem find set. have tried @xmlroot, doesn't seem have impact on resulting json (expected).

personally i'd think it's api consumers job bend api, not other way around.

i'd suggest taking @ illustration of massaging payload shape ember likes:

transform json appropriate format restadapter emberjs

symfony2 fosrestbundle jmsserializerbundle

Comments

Popular posts from this blog

php - Android app custom user registration and login with cookie using facebook sdk -

django - Access session in user model .save() -

php - .htaccess Multiple Rewrite Rules / Prioritizing -