Ive tried the following things and they dont seem to work.
Ember.js Rest Adapter: mapping JSON with no root (.NET Web API)
How can I add a custom root node when serializing an object with JSON.NET?
Im using a web api controller for this.
This is my class and im returning a list of it:
[JsonObject(Title = "rootNamedObject")]
public class RootNamedObject
{
[JsonProperty("ObjectId")]
public int Id { get; set; }
[JsonProperty("Description")]
public string Description { get; set; }
}
Right now this is my result:
[
{
"ObjectId": 1,
"Description": "Description 1",
},
{
"ObjectId": 2,
"Description": "Description 2",
}
]
I need to generate this:
{
"rootNamedObject": [
{
"ObjectId": 1,
"Description": "Description 1"
}
Basically just add the name of the class to the result!