I have a function that send a JSONResult, Now i want to use that function in C# and convert that JSONResult to IEnumerable so i can iterate on that result and pass that data to a SelectList function. Can i do this and how? Im using Asp.Net MVC, JQuery and C#
Can i convert JSONResult to IEnumerable list in C#
2.1k Views Asked by Fraz Sundal At
2
There are 2 best solutions below
0
Ali Osman Yavuz
On
Also it can be done in this way.
var data = GetJsonResultData(); //call to JsonResult method.
var datastr = new System.Web.Script.Serialization.JavaScriptSerializer().Serialize(data.Data); // convert json object to string.
var dataclass = Newtonsoft.Json.JsonConvert.DeserializeObject<List<modeldto>>(datastr ); // string json data to class list
Related Questions in C#
- Passing arguments to main in C using Eclipse
- kernel module does not print packet info
- error C2016 (C requires that a struct or union has at least one member) and structs typedefs
- Drawing with ncurses, sockets and fork
- How to catch delay-import dll errors (missing dll or symbol) in MinGW(-w64)?
- Configured TTL for A record(s) backing CNAME records
- Allocating memory for pointers inside structures in functions
- Finding articulation point of undirected graph by DFS
- C first fgets() is being skipped while the second runs
- C std library don't appear to be linked in object file
- gcc static library compilation
- How to do a case-insensitive string comparison?
- C programming: Create and write 2D array of files as function
- How to read a file then store to array and then print?
- Function timeouts in C and thread
Related Questions in JQUERY
- In Datatables, start value resets to 0, when column sorting
- Bootstrap modal not showing at the desired position on a web page when the screen size is smaller
- window.location.href redirects but is causing problems on the webpage
- Using JQuery Date Slider
- Storing selected language in localStorage
- How to stop other divs from still showing when i click a different button?
- Check multiple values with jQuery
- Bootstrap component does not want to render in Datatables function
- put white spaces when entering an amount moneytype symfony
- Trouble accessing custom header in AJAX response using jQuery in Fiware Keyrock
- I just cant make it work, HTML, JS and Firebase error
- Didn't declared variable still not getting any error in JavaScript
- Move element horizontally while scrolling vertically in pure JavaScript
- allow multi carousel in same page
- Embedded TikTok posts / thumbnail styling issue
Related Questions in ASP.NET-MVC-2
- The controller for path '/' could not be found or it does not implement IController
- how to add bootstrap template to ASP.net MVC 2 project
- Suggestion with MVC2 DI and migrating a legacy system
- Upgrading from MVC2 to MVC5 project
- The IControllerFactory 'Munq.MVC.MunqControllerFactory' did not return a controller for the name 'Home'
- Showing Bootstap Model to Create Form with Some Parameters
- System.OutOfMemoryException when tried with 70 files SharpZipLib
- Find All Extension Methods for HTMLHelper, URLHelper and AJAXHelper Types
- Active Directory with multi factor authentication for an existing web application
- How to receive an array in AJAX send from the ASP .NET controller?
- How do I create an empty model to pass to an insert-update view when there are more than on model in the dbcontext?
- Binding List of Lists in MVC 2.0
- how to use google calendar api in .net MVC 2 using this sample https://developers.google.com/calendar/quickstart/dotnet
- How to override default required error message
- Automatically add column to data table according to week
Related Questions in JSONRESULT
- Issue with Tastedive API in Data Collection and Processing with Python Course (University of Michigan Runstone Environment)
- how to fix this.validator is not a function
- Gmaps results only local even when i query another city
- Get children of multiple roots expected json result
- Json is wrapped with the class name, how to get the raw JSON inner data
- How to set up a Microsoft SQL Server API that will accept REST requests and provide JSON responses?
- Can't send parameter with @ViewData["Param"]
- Model binding with multiple rows in ASP.NET Core MVC
- Get JsonResult within ActionResult
- JsonResult object to JObject
- Json from DataTable returns single element as an array
- How to Pass JsonResult Data to Controller ActionResult and Extract it?
- How to return a error message in json result in C#?
- SpeechRecognizerListener giving Bundle[EMPTY_PARCEL] in onResults(Bundle results) majority devices which have android 11
- go grammes - how to get property from gremlin, not just the value with go grammes
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
why not:
and you are reusing everything.