js object to c# object
// Construct a object in JS
var obj = {
id: 0 ,
userName: 'Bill'
};
// C# class:
public class myClass
{
public int id;
public string userName;
}
// Then for example using AJAX send your data to C#,
// and deserialize, when you need work with object
$.ajax({
type: "POST",
// Note that you need to pass the method as url
url: '<your server url>' + 'DeserializeObject',
// your data is the object you want to send
data: obj,
contentType: "application/text; charset=utf-8",
dataType: "text"
})
[HttpPost]
public void DeserializeObject(string objJson)
{
var obj = (new JavascriptSerializer()).Deserialize<myClass>(objJson);
}
Also in JavaScript:
- how to make so chrome open closed tabs automatically
- react and bootstrap
- how to get the last element in javascript
- discord.js arguments
- change style on click react
- jquery append
- export aab react native
- mutable array methods in javascript
- on hover add class on children jquery
- what is react native
- js select div
- make submit button not refresh page
- read json data from file
- angular open poort in network
- angular scroll to element horizontally
- reactjs start project
- update node two versions mac
- javascript add string to middle of string
- how display same paragraph in all pages of website in js
- node read file sync
- export multiple functions react
- jquery add onclick
- remove row from table with XMLHttpRequest()
- search array for property js