<head runat="server">
<title></title>
<script language="javascript" type="text/javascript" src="Scripts/jquery-1.6.2.js"></script>
<script language="javascript" type="text/javascript" src="Scripts/json2.js"></script>
</head>
var EmployeeSerialized = JSON.stringify(GetInput()); //Convert object to JSON string
**var myobj = jQuery.parseJSON(EmployeeSerialized); //Use jQuery lib to translate JSON to Javascript object**
var myobj2 = JSON.parse(EmployeeSerialized); //alternative way: Use Json2.js lib to translate JSON to Javascript object
function GetInput()
{
var emp = new Object();
emp.Name = 'Brij';
emp.Age = '27';
return emp;
}
What is the jQuery way to convert a Javascript object to JSON without using the JSON2.js library?
Simply answer: sorry, jQuery does not support encoding into JSON, you have to use either native browser support or
json2.js