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
- How to sort these using Javascript or Jquery Most effectively
- Ajax jQuery firing multiple time display event for the same result
- .hover() seems to overwrite .click()
- Check for numeric value with optional commas javascript
- Extending Highmaps Side Effect
- Array appending after each onclick and loop in javascript
- how can i append part of a table based on how many tr it has?
- Play multiple audio files in a slider
- Remove added set of rows
- Access property of an object of type [Model] in JQuery
- AJAX PHP - Reload div after submit
- proengsoft/laravel-jsvalidation ReferenceError: jQuery is not defined
- when a checkbox is checked how to display a different hidden element using javascript
- Get jquery error Uncaught RangeError: Maximum call stack size exceeded
- Removing only the closest thead on table filtering
Related Questions in ASP.NET-MVC-2
- How can i display the Role name for a user in ASP.NET
- How to upgrade mvc2 to mvc5?
- Can a existing MVC2 application migrated to Azure Cloud Service Project?
- Asp.net MVC2 login to MVC5 login
- The specified named connection is either not found in the configuration
- expand a drop downlist when click on the more option
- Change date format in whole application
- Rendering MVC2 view to a string in unit test
- ASP.Net MVC 2 - Code for master page
- Simple paging in mvc 2
- asp.net MVC2 - can not config folder View in folder Worldstore
- Uploading multiple files asp.net mvc4 in a single form
- Sql Server 2012 store pdf
- How to pass the list value at redirect to action in mvc 2
- mvc2 to mvc3 validation issues
Related Questions in JSONRESULT
- json writer adding extra slash to the serialized file
- Can I exchange data between view and JsonResult method using ViewBag?
- How to getback response from server
- Asp.net mvc return to controller from jsonresult
- Error during serialization using the JSON JavaScriptSerializer. Should be using the JSON.NET JsonSerializer
- C# receiving json string but unable to deserialize it
- How to unit test an Action method which returns JsonResult?
- Can i convert JSONResult to IEnumerable list in C#
- Return Json of SelectList in asp.net mvc?
- HighCharts & MVC: How to load whole graph definition and data with JSON?
- window.location.href not redirecting in IE 8
- MVC 4 JsonResult rendering raw string instead of View
- Returning JSONResult without switching views
- How to parse JSON string and check if result contains the text, then ignore or allow it?
- how to fix this.validator is not a function
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.