V24s

"Get Updates : Subscribe to our e-mail newsletter to receive updates........" "Good Luck frnds" Admission 2018 Application Form 2018 Colleges Entrance Exam 2018 Results 2018 Notification 2018 University Educational Jobs 2018 Government Jobs 2018

Search This Blog v24s guys

Follow by Email

03 April, 2013

jQuery Read and Parse JSON String using ParseJSON Method

Introduction
   
Here I will explain how to read and Parse 
JSON string in jQuery using ParseJSON method in JavaScript,asp.net and get string value from JSON string in jQuery.

Description: 
   
In previous posts I explained 
jQuery Get number of facebook likes, shares count for url, jQuery Google Currency Converter API Example, jQuery Highlight gridview rows on mouseover, jQuery Change style of controls, Show multiple months in datepicker, and many articles relating to jQuery, modal popup, asp.net. Now I will explain how to read and Parse JSON string in jQuery using ParseJSON method in JavaScript,asp.net.

To implement this functionality we need to write the code like as shown below


<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>jQuery Read and Parse Data using ParseJSON method</title>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.8.2.js"></script>
<script type="text/javascript">
$(function() {
var name = '';
var jsonstr = '[{"UserName":"Suresh","UserID":"1"},{"UserName":"Aspdotnet","UserID":"2"}]';
var obj = $.parseJSON(jsonstr);
$.each(obj, function() {
name += this['UserName'] + "<br/>";
});
$('#divjson').html(name); ;
})
</script>
</head>
<body>
<div id="divjson">
</div>
</body>
</html>
In above code we used parseJSON method to read formatted JSON string

Demo

Once we run above code we will get output like as shown below

Suresh
Aspdotnet
Post a Comment

Popular Posts

Recent Posts

Google Analytics