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.
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.
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>
|
Demo
Once
we run above code we will get output like as shown below
Suresh
Aspdotnet
|
If you enjoyed this post, please support the blog below. It's FREE! Get the latest Asp.net, C#.net, VB.NET, jQuery, Plugins & Code Snippets for FREE by subscribing to our Facebook, Twitter, RSS feed, or by email. |
|||
|
|||
1 comments :
Hi suresh...
Can u pls tell how to parse the following using Js with Asp.
http://pathwaytechnologies.in/butlerjson.php
Note: Only a member of this blog may post a comment.