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
opts) - {
- //Code for filling list ommited
- Dictionary<string, List
> dic1 = new Dictionary<string, List - 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
Varun SetiaPosted Oct 23, 2020, 3:17 AM
Mageshwaran RPosted Oct 22, 2020, 8:21 AM
Jeroen EverhardPosted Oct 22, 2020, 8:02 AM
Sachin SinghPosted Oct 22, 2020, 7:44 AM