Introduction:
This article explains 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.
To implement this functionality we need to write the code like as shown below
HTML Code:
In above code we used parseJSON method to read formatted JSON string
Output:
This article explains 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.
To implement this functionality we need to write the code like as shown below
HTML Code:
<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":"Ashwani","UserID":"1"},{"UserName":"VepshTech","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
Output:
No comments:
Post a Comment