Kevin Boss
Kevin Boss

Reputation: 145

Combine ember.js and asp.net webapi JSON formats

I am currently building a web app with ember.js and webapi 3. Currently I am facing the problem that webapi sends a JSON result (of an array of DTOs) which doesn't get understood by ember because it is missing a root element.

I didn't got far with the solutions on the web, which mostly just pointed to a template project for VS.

Has someone a simple and understandable solution?

Upvotes: 0

Views: 479

Answers (1)

Kingpin2k
Kingpin2k

Reputation: 47367

I'm going to assume you're talking about Ember-Data.

web-api sends back json in whatever format the object is, so if you're sending back a list/array it's going to return an array of objects. If you have control of the controller then just modify what it's returning.

return new { foos = new List<string>() };

Upvotes: 1

Related Questions