Aspdotnet-Suresh

aspdotnet-suresh offers C#.net articles and tutorials,csharp dot net,asp.net articles and tutorials,VB.NET Articles,Gridview articles,code examples of asp.net 2.0 /3.5,AJAX,SQL Server Articles,examples of .net technologies

jQuery Read and Parse JSON String using ParseJSON Method

Feb 8, 2013
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

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.

subscribe by rss Subscribe by RSS subscribe by email Subscribe by Email

1 comments :

Anonymous said...

Hi suresh...
Can u pls tell how to parse the following using Js with Asp.

http://pathwaytechnologies.in/butlerjson.php

Give your Valuable Comments

Note: Only a member of this blog may post a comment.

© 2015 Aspdotnet-Suresh.com. All Rights Reserved.
The content is copyrighted to Suresh Dasari and may not be reproduced on other websites without permission from the owner.