I have a question, I have this code below in controller
:
[Authorize]
public JsonResult Teste()
{
var licencas = new List<Object>();
licencas.Add(new {
Responsavel = "José",
Ticket = 79007,
Descricao = "RC - 01 Desktop padrão - José",
Status = "Pendente Gestão",
SLA = "10/10/2013"
});
licencas.Add(new {
Responsavel = "Maria",
Ticket = 79037,
Descricao = "RC - 01 Notebook padrão - Maria",
Status = "Pendente Pedido",
SLA = "10/11/2013"
});
return this.Json(licencas, JsonRequestBehavior.AllowGet);
}
That returns the following JSON:
[
{
"Responsavel":"José",
"Ticket":79007,"Descricao":"RC - 01 Desktop padrão - José",
"Status":"Pendente Gestão",
"SLA":"10/10/2013"
},
{"Responsavel":"Maria",
"Ticket":79037,
"Descricao":"RC - 01 Notebook padrão - Maria",
"Status":"Pendente Pedido",
"SLA":"10/11/2013"
}
]
But I need it to return like this:
licencas = [
{
"Responsavel":"José",
"Ticket":79007,"Descricao":"RC - 01 Desktop padrão - José",
"Status":"Pendente Gestão",
"SLA":"10/10/2013"
},
{"Responsavel":"Maria",
"Ticket":79037,
"Descricao":"RC - 01 Notebook padrão - Maria",
"Status":"Pendente Pedido",
"SLA":"10/11/2013"
}
]
What do I do to return JSON this way?