Hello,
I have a Controller in which I create a list and want to return this as JSON.
- public class ItemsController : ApiController
- {
- public IHttpActionResult GetItems(ODataQueryOptions<App4Sales_Items> opts)
- {
-
- Dictionary<string, List<App4Sales_Items>> dic1 = new Dictionary<string, List<App4Sales_Items();
- dic1.Add("Results", result);
- JavaScriptSerializer js = new JavaScriptSerializer();
- var test = js.Serialize(dic1);
-
- return Ok(test);
- }
- }
This returns the following JSON:
"{\"Results\":[{\"Id\":\"dc58d488-ab94-4c77-a11d-1cb135f7f2f4\"}]}"
But I would like:
{\"Results\":[{\"Id\":\"dc58d488-ab94-4c77-a11d-1cb135f7f2f4\"}]}, thus minus the most outer quotes.
How can I do that?
Jeroen