hi..
How to send Json Data to Web API using Post Request.
My Json value is like below.
var json123 = {
"firstname": {
"value": "john",
"versions": [
{
"value": "john",
"selected": false
},
"lastname": {
"value": "paul",
"versions": [
{
"value": "paul",
"selected": false
},
"email": {
"value": "[email protected]",
"versions": [
{
"value": "[email protected]",
"selected": false
},
}
Here I need to pass all data to my post request and after receiving the request i need to take the each attribute value through c# only.
How to do this..
need ur suggestions with examples.
Regards,
Gopal.s
Loading

Jaganathan BantheswaranRank #170 · 14.1K reputationPosted Dec 17, 2013, 9:54 PM EST
Where you feel difficult, on Post request or Post Action method?
Jignesh TrivediRank #16 · 50.3K reputationPosted Dec 17, 2013, 10:06 PM EST
hi,
please refer below link it might help you
http://www.codeproject.com/Tips/678138/MVC-using-Web-API-and-JQuery-to-GET-or-POST-Data
http://encosia.com/using-jquery-to-post-frombody-parameters-to-web-api/
http://www.asp.net/web-api/overview/formats-and-model-binding/parameter-binding-in-aspnet-web-api
gopal kannan55 reputationPosted Dec 17, 2013, 10:32 PM EST
Thax for your reply.
"firstname": {
"value": "john",
"versions": [
{
"value": "john",
"selected": false
},
"lastname": {
"value": "paul",
"versions": [
{
"value": "paul",
"selected": false
},
"email": {
"value": "john@gmail.com",
"versions": [
{
"value": "john@gmail.com",
"selected": false
},
}
insertData(json123);
}
Here i have used the following post code.
But none of them are worked.
}
But i need to pass the whole data into my post rest service. after receiving the values from the api then only i need to take the column value using c#.
Here what i am missing.
How to achieve this.
Regards,
Gopal.s
Jaganathan BantheswaranRank #170 · 14.1K reputationPosted Dec 17, 2013, 10:54 PM EST
try,
data: JSON.stringify(json123).
gopal kannan55 reputationPosted Dec 17, 2013, 11:02 PM EST
Jaganathan BantheswaranRank #170 · 14.1K reputationPosted Dec 17, 2013, 11:49 PM EST