[12:50:44.045] Error: assertion failed: Your server returned a hash with the key 0 but you have no mapping for it @ http://10.102.113.48:8080/Ember/assets/js/ember-1.0.0-master.js:52 Error: assertion failed: Your server returned a hash with the key 0 but you have no mapping for it
It’s a bit hard to help out without posting some sort of code sample (preferably in a jsbin).
Would assume your JSON is incorrect - post it?
- My json data in below format which i am sending it from server to frontend.
{“hostCarrierCode”:“cccc”,“boardingPoint”:“aaaa”,“hostFlightNumber”:“bbbb”,“offPoint”:“ddddd”}
- And i am using the below tag for displaying the data which i am getting in the frontend.
{{hostCarrierCode}} , {{boardingPoint}} , {{hostFlightNumber}} , {{offPoint}}
Are you using ember-data, ember-model or a custom adapter?
i am using
DS.RESTAdapter.extend for getting the data from the server. &
App.Employee = DS.Model.extend for mapping the data in the front end.
Ember data needs to match the json returned from your server to a particular model type (this enables sideloading etc). So you need to have a root key for the model type (also, you need to include the id), e.g.
{“employee”: {“id”: “1”,“hostCarrierCode”:“cccc”,“boardingPoint”:“aaaa”,“hostFlightNumber”:“bbbb”,“offPoint”:“ddddd”}}
And if you are returning multiple records then you need to pluralize the key, e.g {“employees”: [{“id”: “1”, “hostCarrierCode”:“cccc”,“boardingPoint”:“aaaa”,“hostFlightNumber”:“bbbb”,“offPoint”:“ddddd”},{“id”: “2”, “hostCarrierCode”:“bbb”,“boardingPoint”:“sss”,“hostFlightNumber”:“bbbb”,“offPoint”:“ddddd”}]}