Quantcast
Channel: Question and Answer » json
Viewing all articles
Browse latest Browse all 148

How to read the json in controller as parameter [on hold]

$
0
0

I am posting a json message from javascript, and same i am trying to read it in the controller method. In the action method i am not able to convert the data object to json format, please guide me how do i convert it back to json message.

   var jsonmsg = {
        "Id": "0AJK11",
        "date": "2011082512560500",
        "accountsno": "12",
        "childItems": [
            { "account": "King", "accountpart": "003333", "position": "1" },
            { "account": "Queene", "accountpart": "33333", "position": "2"},
            { "account": "Price", "accountpart": "", "position": "3"},
            { "account": "Jack", "accountpart": "", "position": "4"},
        ]
    };

    var url = '/ControllerName/MyAction';

    $("#DialogDiv").load(url, {"data":jsonmsg});
    $('#DialogDiv').dialog({
        autoOpen: false,
        width: 1000,
        height: 500,
        overflow:'auto',
        resizable: false,
        modal: true,
        position:'top'
    }).dialog('open');  



public ActionResult MyAction(object data)
{
 ViewBag.modelData = data;
 return PartialView("_AccountView");     
}

Viewing all articles
Browse latest Browse all 148

Trending Articles