{"id":2102,"date":"2011-05-06T11:19:39","date_gmt":"2011-05-06T05:49:39","guid":{"rendered":"http:\/\/JitendraZaa.com\/blog\/?p=2102"},"modified":"2011-05-06T11:19:39","modified_gmt":"2011-05-06T05:49:39","slug":"creating-json-parser-using-jquery","status":"publish","type":"post","link":"https:\/\/www.jitendrazaa.com\/blog\/webtech\/creating-json-parser-using-jquery\/","title":{"rendered":"Creating JSON Parser Using JQuery"},"content":{"rendered":"<p>JSON stands for &#8220;Javascript Object Notation&#8221; and often used to interchange the data between servers. Its use is increased in web development because of its flexibility and data support.<\/p>\n<p>I have created Online JSON parser using JQuery library.<\/p>\n<p style=\"text-align: center;\">&nbsp;<\/p>\n<figure id=\"attachment_2105\" aria-describedby=\"caption-attachment-2105\" style=\"width: 447px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/i0.wp.com\/jitendrazaa.com\/blog\/wp-content\/uploads\/2011\/05\/JSON-Parser-Using-JQuery-Tutorial.jpg?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-2105  \" title=\"JSON Parser Using JQuery Tutorial\" src=\"https:\/\/i0.wp.com\/jitendrazaa.com\/blog\/wp-content\/uploads\/2011\/05\/JSON-Parser-Using-JQuery-Tutorial.jpg?resize=447%2C248&#038;ssl=1\" alt=\"JSON Parser Using JQuery Tutorial\" width=\"447\" height=\"248\" \/><\/a><figcaption id=\"caption-attachment-2105\" class=\"wp-caption-text\">JSON Parser Using JQuery Tutorial<\/figcaption><\/figure>\n<h2><a href=\"https:\/\/jitendrazaa.com\/blog\/wp-content\/uploads\/2011\/05\/OnlineJSONParser.html\">Live Demo &#8211; Online JSON Parser<\/a><\/h2>\n<p><!--more--><\/p>\n<p>Javascript code for the JSON Parser Using JQuery.<\/p>\n<pre class=\"brush: jscript; highlight: [10,11,12,13]; title: ; notranslate\" title=\"\">\nvar num = 1;\nvar className = &quot; &quot;;\nvar jsonData = &quot; &quot;;\n\nfunction parseJSON() {\n  $(&quot;#divMessage&quot;).css(&quot;display&quot;, &quot;block&quot;);\n  $('.placeHolder').html(&quot;&quot;);\n  num = 1;\n  jsonData = $.trim($(&quot;#txtData&quot;).val());\n  $.getJSON(jsonData, function (data) {\n    $.each(data, function (key, val) {\n      getJson(val);\n    });\n    $(&quot;#divMessage&quot;).css(&quot;display&quot;, &quot;none&quot;);\n  });\n}\n\nfunction getJson(JData) {\n  $.each(JData, function (Jkey, Jval) {\n    if (Jval &amp;&amp; typeof Jval == &quot;object&quot;) {\n      getJson(Jval);\n    } else {\n      className = (num % 2 == 0) ? &quot;even&quot; : &quot;odd&quot;;\n      if (num == 1) {\n        $('.placeHolder').append(&quot;&lt;tr&gt;&lt;th&gt;Key&lt;\/th&gt;&lt;th&gt;Value&lt;\/td&gt;&lt;\/th&gt;&quot;);\n      }\n      $('.placeHolder').append(&quot;&lt;tr class=&quot;&quot; + className + &quot;&quot;&gt;&lt;td&gt;&quot; + Jkey + &quot;&lt;\/td&gt;&lt;td&gt;&quot; + Jval + &quot;&lt;\/td&gt;&lt;\/tr&gt;&quot;);\n      num = num + 1;\n    }\n  });\n}\n<\/pre>\n<p>The code is self explanatory, i have used the <a title=\"JQuery JSON Library\" href=\"http:\/\/api.jquery.com\/jQuery.getJSON\/\" target=\"_blank\">getJSON()<\/a> method of the jquery.<\/p>\n<h2><a href=\"https:\/\/jitendrazaa.com\/blog\/wp-content\/uploads\/2011\/05\/OnlineJSONParser.html\">Live Demo &#8211; Online JSON Parser<\/a><\/h2>\n","protected":false},"excerpt":{"rendered":"<p>JQuery JSON Tutorial &#8211; Creating JSON Parser Using JQuery with Source code and live demo<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"advanced_seo_description":"","jetpack_seo_html_title":"","jetpack_seo_noindex":false,"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"jz_research_post":"","_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[19],"tags":[126,134],"class_list":["post-2102","post","type-post","status-publish","format-standard","hentry","category-webtech","tag-javascript","tag-jquery"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack-related-posts":[{"id":2817,"url":"https:\/\/www.jitendrazaa.com\/blog\/salesforce\/gantt-chart-in-salesforce-using-jquery-and-json\/","url_meta":{"origin":2102,"position":0},"title":"Gantt Chart in Salesforce using JQuery and JSON","author":"Jitendra","date":"April 18, 2012","format":false,"excerpt":"Tutorial and Example of creating the Gantt Chart in Salesforce using JQuery and JSON","rel":"","context":"In &quot;Apex&quot;","block_context":{"text":"Apex","link":"https:\/\/www.jitendrazaa.com\/blog\/category\/salesforce\/apex\/"},"img":{"alt_text":"Gantt Chart in Salesforce","src":"https:\/\/i0.wp.com\/jitendrazaa.com\/blog\/wp-content\/uploads\/2012\/04\/Gantt-Chart-in-Salesforce.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/jitendrazaa.com\/blog\/wp-content\/uploads\/2012\/04\/Gantt-Chart-in-Salesforce.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/jitendrazaa.com\/blog\/wp-content\/uploads\/2012\/04\/Gantt-Chart-in-Salesforce.png?resize=525%2C300&ssl=1 1.5x"},"classes":[]},{"id":3347,"url":"https:\/\/www.jitendrazaa.com\/blog\/salesforce\/ajax-based-autocomplete-component-in-salesforce-using-jquery-ui-and-json\/","url_meta":{"origin":2102,"position":1},"title":"AutoComplete Component in Visualforce using JQueryUI","author":"Jitendra","date":"June 28, 2013","format":false,"excerpt":"In this tutorial, I am going to explain very Simple AJAX and JSON based Auto Complete component with the help of JQuery UI. First I am assuming that you already have Static Resource of named \"AutoCompleteWithModal\"\u009d. This Static resource has all images, CSS and JQuery library needed to implement this\u2026","rel":"","context":"In &quot;HTML&quot;","block_context":{"text":"HTML","link":"https:\/\/www.jitendrazaa.com\/blog\/category\/webtech\/web\/"},"img":{"alt_text":"JQuery UI and JSON based AJAX AutoComplete Component in Salesforce","src":"https:\/\/i0.wp.com\/jitendrazaa.com\/blog\/wp-content\/uploads\/2013\/06\/JQuery-UI-and-JSON-based-AJAX-AutoComplete-Component-in-Salesforce.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/jitendrazaa.com\/blog\/wp-content\/uploads\/2013\/06\/JQuery-UI-and-JSON-based-AJAX-AutoComplete-Component-in-Salesforce.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/jitendrazaa.com\/blog\/wp-content\/uploads\/2013\/06\/JQuery-UI-and-JSON-based-AJAX-AutoComplete-Component-in-Salesforce.png?resize=525%2C300&ssl=1 1.5x"},"classes":[]},{"id":3649,"url":"https:\/\/www.jitendrazaa.com\/blog\/salesforce\/client-side-templating-using-underscore-js-and-jquery\/","url_meta":{"origin":2102,"position":2},"title":"Client side Templating using Underscore.js and JQuery","author":"Jitendra","date":"January 2, 2014","format":false,"excerpt":"Recently, I ran into requirement where I was getting JSON response and needed to render it on my Mobile application. I had two Options, Server side processing and Client side Templating. I studied and checked both way ; came to conclusion on using Client side Templating. There are many plugins\u2026","rel":"","context":"In &quot;HTML&quot;","block_context":{"text":"HTML","link":"https:\/\/www.jitendrazaa.com\/blog\/category\/webtech\/web\/"},"img":{"alt_text":"Underscore.js","src":"https:\/\/i0.wp.com\/jitendrazaa.com\/blog\/wp-content\/uploads\/2014\/01\/Underscore-js.png?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":2843,"url":"https:\/\/www.jitendrazaa.com\/blog\/others\/tips\/streaming-api-using-jquery-salesforce\/","url_meta":{"origin":2102,"position":3},"title":"Streaming API Using JQuery &#8211; Salesforce","author":"Jitendra","date":"May 6, 2012","format":false,"excerpt":"Tutorial of Streaming API in Salesforce with Source code and Demo Video - Implementation of Bayeux protocol and CometD using JQuery and JSON","rel":"","context":"In &quot;Tech Tips&quot;","block_context":{"text":"Tech Tips","link":"https:\/\/www.jitendrazaa.com\/blog\/category\/others\/tips\/"},"img":{"alt_text":"Salesforce Streaming API - Create Push topic","src":"https:\/\/i0.wp.com\/jitendrazaa.com\/blog\/wp-content\/uploads\/2012\/05\/Salesforce-Streaming-API-Create-Push-topic-1024x332.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/jitendrazaa.com\/blog\/wp-content\/uploads\/2012\/05\/Salesforce-Streaming-API-Create-Push-topic-1024x332.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/jitendrazaa.com\/blog\/wp-content\/uploads\/2012\/05\/Salesforce-Streaming-API-Create-Push-topic-1024x332.png?resize=525%2C300&ssl=1 1.5x"},"classes":[]},{"id":1527,"url":"https:\/\/www.jitendrazaa.com\/blog\/microsoft\/net\/ajax-based-multiselect-jquery-autocomplete-control-in-asp-net\/","url_meta":{"origin":2102,"position":4},"title":"Ajax Based Multiselect JQuery Autocomplete Control in ASP.Net","author":"Jitendra","date":"February 19, 2011","format":false,"excerpt":"Tutorial on creating Ajax Based Multiselect JQuery Autocomplete User Control in ASP.Net","rel":"","context":"In &quot;ASP.NET&quot;","block_context":{"text":"ASP.NET","link":"https:\/\/www.jitendrazaa.com\/blog\/category\/microsoft\/net\/"},"img":{"alt_text":"Ajax Based Multiselect JQuery Autocomplete Control in ASP.Net","src":"https:\/\/i0.wp.com\/jitendrazaa.com\/blog\/wp-content\/uploads\/2011\/02\/Ajax-Based-Multiselect-JQuery-Autocomplete-Control-in-ASP.Net_.png?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":790,"url":"https:\/\/www.jitendrazaa.com\/blog\/microsoft\/net\/row-expand-collapse-using-jquery-and-ajax\/","url_meta":{"origin":2102,"position":5},"title":"Row expand collapse using jquery and Ajax","author":"Jitendra","date":"August 19, 2010","format":false,"excerpt":"Using JQuery and Ajax to expand and collapse the row in ASP.NET","rel":"","context":"In &quot;ASP.NET&quot;","block_context":{"text":"ASP.NET","link":"https:\/\/www.jitendrazaa.com\/blog\/category\/microsoft\/net\/"},"img":{"alt_text":"Ajax JQuery Row Expand Collapse","src":"https:\/\/i0.wp.com\/jitendrazaa.com\/blog\/wp-content\/uploads\/2010\/08\/rowexpand-300x203.png?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]}],"jetpack_likes_enabled":true,"_links":{"self":[{"href":"https:\/\/www.jitendrazaa.com\/blog\/wp-json\/wp\/v2\/posts\/2102","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.jitendrazaa.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.jitendrazaa.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.jitendrazaa.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.jitendrazaa.com\/blog\/wp-json\/wp\/v2\/comments?post=2102"}],"version-history":[{"count":0,"href":"https:\/\/www.jitendrazaa.com\/blog\/wp-json\/wp\/v2\/posts\/2102\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.jitendrazaa.com\/blog\/wp-json\/wp\/v2\/media?parent=2102"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.jitendrazaa.com\/blog\/wp-json\/wp\/v2\/categories?post=2102"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.jitendrazaa.com\/blog\/wp-json\/wp\/v2\/tags?post=2102"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}