I have the following json Object that I pass to my c# server
[
{
"ID": 1,
"FirstName": "Jay",
"LastName": "Smith"
},
{
"ID": 2,
"FirstName": "Rich",
"LastName": "Son"
},
{
"ID": 3,
"FirstName": "Emmy",
"LastName": "Wat"
}
]
I create a Class like this
public class Person
{
public int ID { get; set; }
public string FirstName { get; set; }
public string LastName { get; set; }
}
When I do this
public static string addRecord(string details)
{
Person tempRecord = JsonConvert.DeserializeObject<Person>(details);
string tempFN = tempRecord.FirstName;
return tempFN;
}
I can't get the actual result.
What am I doing Wrong? Do I have to make another List in my Person class? Any help?
UPDATE - my record is from Grid and this is how I send it to my server
var jsonD = Ext.encode(Ext.pluck(this.myGridStore.data.items, 'data'));
Ext.Ajax.request({
scope: this,
method: 'POST',
url: 'myApp/AddRecord',
headers: { 'Content-Type': 'application/json' },
dataType: 'json',
jsonData: jsonD,
success: function (response) {
},
failure: function (response) {
}
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With