{"id":350,"date":"2016-06-02T13:59:07","date_gmt":"2016-06-02T13:59:07","guid":{"rendered":"https:\/\/eshopsync.com\/?p=350"},"modified":"2025-10-14T10:25:34","modified_gmt":"2025-10-14T10:25:34","slug":"generate-json-data-convert-pageblocktable","status":"publish","type":"post","link":"https:\/\/eshopsync.com\/generate-json-data-convert-pageblocktable\/","title":{"rendered":"Generate JSON data and Convert in PageBlockTable"},"content":{"rendered":"<p>In this post, I am going to share the information how to <strong> Generate JSON data and Convert in PageBlockTable<\/strong> and display the same in Visual Force page in tabular format.<\/p>\n<p>&nbsp;<\/p>\n<div class=\"panel panel-primary\">\n<div class=\"panel-heading\">\n<h3 class=\"panel-title\">JSON ( Java Script Object Notation )<\/h3>\n<\/div>\n<\/div>\n<div class=\"panel-body\">\n<p>JSON (JavaScript Object Notation) is a lightweight data-interchange format. It is easy for humans to read and write. It is easy for machines to parse and generate.<\/p>\n<p>The Apex JSON classes provide easy-to-use means of serializing\/deserializing Apex objects into\/from JSON content. This article explained the basics about handling JSON content in Apex. The code samples provided in the article demonstrated how different serialization and deserialization options could be implemented in Apex.<\/p>\n<p>1. JSON has a smaller footprint than XML, which means it can be transmitted and parsed faster than XML.<\/p>\n<p>2. JSON.serialize() is used to generate JSON.<\/p>\n<p>3. It Simply have a key and value pair combination.<\/p>\n<p>4. DataTypes supported by the JSON are &#8220;Number, String, Boolean, Array, Object and null&#8221;.<\/p>\n<p>5. Key and value pair are separated by colon &#8220;:&#8221;<\/p>\n<p>6. Object is enclosed between curly brackets &#8220;{&#8221; and &#8220;}&#8221;.<\/p>\n<p>7. Array is enclosed using square bracket &#8220;[&#8220;, &#8220;]&#8221; separated by the comma.<\/p>\n<\/div>\n<div class=\"panel panel-primary\">\n<div class=\"panel-heading\">\n<h3 class=\"panel-title\"><i class=\"fa fa-hand-o-right\"><\/i>Serialization and Deserialization<\/h3>\n<\/div>\n<\/div>\n<div class=\"panel-body\">\n<p><strong>Apex Code :<\/strong><\/p>\n<pre class=\"brush:sql\">public with sharing class jsongenerator {\r\n  public   string jsondata{get;set;}\r\n    public list&lt;jsonvalue&gt; jsonstring { get; set; }\r\n\r\npublic jsongenerator(){\r\n    \r\n    string soql ='select name,industry from account';\r\n    List&lt;Account&gt; acct = Database.Query(soql);\r\n    jsondata = JSON.serialize(acct);\r\n    jsonstring = (List&lt;jsonvalue&gt;) System.JSON.deserialize(jsondata , List&lt;jsonvalue&gt;.class);\r\n            \r\n}\r\npublic class jsonvalue{\r\n\r\n            public String name{get;set;}\r\n            public String industry{get;set;}\r\n         \r\n}\r\n\r\n\r\n}\r\n\r\n\r\n<\/pre>\n<p><strong>Visualforce Page:<\/strong><\/p>\n<pre class=\"brush:sql\">&lt;apex:page controller=\"jsongenerator\" showHeader=\"false\"&gt; \r\n{!jsondata}\r\n&lt;apex:pageblock &gt;\r\n&lt;apex:pageblockTable value=\"{!jsonstring}\" var=\"json\"&gt;\r\n&lt;apex:column headerValue=\"Name\" value=\"{!json.name}\"\/&gt;\r\n&lt;apex:column headerValue=\"Industry\" value=\"{!json.industry}\"\/&gt;\r\n&lt;\/apex:pageblockTable&gt;\r\n&lt;\/apex:pageblock&gt;\r\n&lt;\/apex:page&gt;<\/pre>\n<\/div>\n<div class=\"panel panel-primary\">\n<div class=\"panel-heading\">\n<h3 class=\"panel-title\">Json Data in Pageblock Table<\/h3>\n<\/div>\n<\/div>\n<div class=\"panel-body\">\u00a0<img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-352 size-full\" src=\"https:\/\/eshopsync.com\/wp-content\/uploads\/2016\/05\/jsondata.png\" alt=\"jsondata\" width=\"1266\" height=\"597\" srcset=\"https:\/\/eshopsync.com\/wp-content\/uploads\/2016\/05\/jsondata.png 1266w, https:\/\/eshopsync.com\/wp-content\/uploads\/2016\/05\/jsondata-300x141.png 300w, https:\/\/eshopsync.com\/wp-content\/uploads\/2016\/05\/jsondata-768x362.png 768w, https:\/\/eshopsync.com\/wp-content\/uploads\/2016\/05\/jsondata-1024x483.png 1024w\" sizes=\"auto, (max-width: 1266px) 100vw, 1266px\" \/><\/div>\n<div class=\"panel panel-primary\">\n<div class=\"panel-heading\">\n<h3 class=\"panel-title\"><i class=\"fa fa-user\"><\/i>Support<\/h3>\n<\/div>\n<\/div>\n<div class=\"panel-body\">\n<p>That\u2019s all forGenerate JSON data and Convert in PageBlockTable \u00a0in Salesforce, still have any issue feel free to add a ticket and let us know your views to make the product better <a href=\"https:\/\/webkul.com\/ticket\/index.php\" rel=\"nofollow\">https:\/\/webkul.com\/ticket\/index.php<\/a><\/p>\n<p><strong>Read More: <a href=\"https:\/\/eshopsync.com\/how-to-implement-json-in-apex-salesforce\/\">How to implement JSON in Apex Salesforce<\/a><\/strong><\/p>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>In this post, I am going to share the information how to Generate JSON data and Convert in PageBlockTable and display the same in Visual Force page in tabular format.<a href=\"https:\/\/eshopsync.com\/generate-json-data-convert-pageblocktable\/\"> &#8230;<\/a><\/p>\n","protected":false},"author":4,"featured_media":499,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-350","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-uncategorized"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.8 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Generate JSON data and Convert in PageBlockTable<\/title>\n<meta name=\"description\" content=\"how to Generate JSON data and Convert in PageBlockTable and display the same in Visual Force page in tabular format.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/eshopsync.com\/generate-json-data-convert-pageblocktable\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Generate JSON data and Convert in PageBlockTable\" \/>\n<meta property=\"og:description\" content=\"how to Generate JSON data and Convert in PageBlockTable and display the same in Visual Force page in tabular format.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/eshopsync.com\/generate-json-data-convert-pageblocktable\/\" \/>\n<meta property=\"og:site_name\" content=\"eShopSync\" \/>\n<meta property=\"article:published_time\" content=\"2016-06-02T13:59:07+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-10-14T10:25:34+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/eshopsync.com\/wp-content\/uploads\/2016\/06\/Code-Snippet-eshopsync-1.png\" \/>\n\t<meta property=\"og:image:width\" content=\"945\" \/>\n\t<meta property=\"og:image:height\" content=\"356\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Nansi Kela\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Nansi Kela\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/eshopsync.com\\\/generate-json-data-convert-pageblocktable\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/eshopsync.com\\\/generate-json-data-convert-pageblocktable\\\/\"},\"author\":{\"name\":\"Nansi Kela\",\"@id\":\"https:\\\/\\\/eshopsync.com\\\/#\\\/schema\\\/person\\\/2efe54edf3f05f1b1bff15ae7442c6a1\"},\"headline\":\"Generate JSON data and Convert in PageBlockTable\",\"datePublished\":\"2016-06-02T13:59:07+00:00\",\"dateModified\":\"2025-10-14T10:25:34+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/eshopsync.com\\\/generate-json-data-convert-pageblocktable\\\/\"},\"wordCount\":249,\"commentCount\":0,\"image\":{\"@id\":\"https:\\\/\\\/eshopsync.com\\\/generate-json-data-convert-pageblocktable\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/eshopsync.com\\\/wp-content\\\/uploads\\\/2016\\\/06\\\/Code-Snippet-eshopsync-1.png\",\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/eshopsync.com\\\/generate-json-data-convert-pageblocktable\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/eshopsync.com\\\/generate-json-data-convert-pageblocktable\\\/\",\"url\":\"https:\\\/\\\/eshopsync.com\\\/generate-json-data-convert-pageblocktable\\\/\",\"name\":\"Generate JSON data and Convert in PageBlockTable\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/eshopsync.com\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/eshopsync.com\\\/generate-json-data-convert-pageblocktable\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/eshopsync.com\\\/generate-json-data-convert-pageblocktable\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/eshopsync.com\\\/wp-content\\\/uploads\\\/2016\\\/06\\\/Code-Snippet-eshopsync-1.png\",\"datePublished\":\"2016-06-02T13:59:07+00:00\",\"dateModified\":\"2025-10-14T10:25:34+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/eshopsync.com\\\/#\\\/schema\\\/person\\\/2efe54edf3f05f1b1bff15ae7442c6a1\"},\"description\":\"how to Generate JSON data and Convert in PageBlockTable and display the same in Visual Force page in tabular format.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/eshopsync.com\\\/generate-json-data-convert-pageblocktable\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/eshopsync.com\\\/generate-json-data-convert-pageblocktable\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/eshopsync.com\\\/generate-json-data-convert-pageblocktable\\\/#primaryimage\",\"url\":\"https:\\\/\\\/eshopsync.com\\\/wp-content\\\/uploads\\\/2016\\\/06\\\/Code-Snippet-eshopsync-1.png\",\"contentUrl\":\"https:\\\/\\\/eshopsync.com\\\/wp-content\\\/uploads\\\/2016\\\/06\\\/Code-Snippet-eshopsync-1.png\",\"width\":945,\"height\":356},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/eshopsync.com\\\/generate-json-data-convert-pageblocktable\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/eshopsync.com\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Generate JSON data and Convert in PageBlockTable\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/eshopsync.com\\\/#website\",\"url\":\"https:\\\/\\\/eshopsync.com\\\/\",\"name\":\"eShopSync\",\"description\":\"Salesforce, SAP, Pardot Integration For E-Commerce Store\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/eshopsync.com\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/eshopsync.com\\\/#\\\/schema\\\/person\\\/2efe54edf3f05f1b1bff15ae7442c6a1\",\"name\":\"Nansi Kela\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/f330d16c8f951a609b52375b27d65ca770ad3b17c39246e85f563004947de40a?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/f330d16c8f951a609b52375b27d65ca770ad3b17c39246e85f563004947de40a?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/f330d16c8f951a609b52375b27d65ca770ad3b17c39246e85f563004947de40a?s=96&d=mm&r=g\",\"caption\":\"Nansi Kela\"},\"url\":\"https:\\\/\\\/eshopsync.com\\\/author\\\/nansi-kela80\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Generate JSON data and Convert in PageBlockTable","description":"how to Generate JSON data and Convert in PageBlockTable and display the same in Visual Force page in tabular format.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/eshopsync.com\/generate-json-data-convert-pageblocktable\/","og_locale":"en_US","og_type":"article","og_title":"Generate JSON data and Convert in PageBlockTable","og_description":"how to Generate JSON data and Convert in PageBlockTable and display the same in Visual Force page in tabular format.","og_url":"https:\/\/eshopsync.com\/generate-json-data-convert-pageblocktable\/","og_site_name":"eShopSync","article_published_time":"2016-06-02T13:59:07+00:00","article_modified_time":"2025-10-14T10:25:34+00:00","og_image":[{"width":945,"height":356,"url":"https:\/\/eshopsync.com\/wp-content\/uploads\/2016\/06\/Code-Snippet-eshopsync-1.png","type":"image\/png"}],"author":"Nansi Kela","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Nansi Kela","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/eshopsync.com\/generate-json-data-convert-pageblocktable\/#article","isPartOf":{"@id":"https:\/\/eshopsync.com\/generate-json-data-convert-pageblocktable\/"},"author":{"name":"Nansi Kela","@id":"https:\/\/eshopsync.com\/#\/schema\/person\/2efe54edf3f05f1b1bff15ae7442c6a1"},"headline":"Generate JSON data and Convert in PageBlockTable","datePublished":"2016-06-02T13:59:07+00:00","dateModified":"2025-10-14T10:25:34+00:00","mainEntityOfPage":{"@id":"https:\/\/eshopsync.com\/generate-json-data-convert-pageblocktable\/"},"wordCount":249,"commentCount":0,"image":{"@id":"https:\/\/eshopsync.com\/generate-json-data-convert-pageblocktable\/#primaryimage"},"thumbnailUrl":"https:\/\/eshopsync.com\/wp-content\/uploads\/2016\/06\/Code-Snippet-eshopsync-1.png","inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/eshopsync.com\/generate-json-data-convert-pageblocktable\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/eshopsync.com\/generate-json-data-convert-pageblocktable\/","url":"https:\/\/eshopsync.com\/generate-json-data-convert-pageblocktable\/","name":"Generate JSON data and Convert in PageBlockTable","isPartOf":{"@id":"https:\/\/eshopsync.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/eshopsync.com\/generate-json-data-convert-pageblocktable\/#primaryimage"},"image":{"@id":"https:\/\/eshopsync.com\/generate-json-data-convert-pageblocktable\/#primaryimage"},"thumbnailUrl":"https:\/\/eshopsync.com\/wp-content\/uploads\/2016\/06\/Code-Snippet-eshopsync-1.png","datePublished":"2016-06-02T13:59:07+00:00","dateModified":"2025-10-14T10:25:34+00:00","author":{"@id":"https:\/\/eshopsync.com\/#\/schema\/person\/2efe54edf3f05f1b1bff15ae7442c6a1"},"description":"how to Generate JSON data and Convert in PageBlockTable and display the same in Visual Force page in tabular format.","breadcrumb":{"@id":"https:\/\/eshopsync.com\/generate-json-data-convert-pageblocktable\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/eshopsync.com\/generate-json-data-convert-pageblocktable\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/eshopsync.com\/generate-json-data-convert-pageblocktable\/#primaryimage","url":"https:\/\/eshopsync.com\/wp-content\/uploads\/2016\/06\/Code-Snippet-eshopsync-1.png","contentUrl":"https:\/\/eshopsync.com\/wp-content\/uploads\/2016\/06\/Code-Snippet-eshopsync-1.png","width":945,"height":356},{"@type":"BreadcrumbList","@id":"https:\/\/eshopsync.com\/generate-json-data-convert-pageblocktable\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/eshopsync.com\/"},{"@type":"ListItem","position":2,"name":"Generate JSON data and Convert in PageBlockTable"}]},{"@type":"WebSite","@id":"https:\/\/eshopsync.com\/#website","url":"https:\/\/eshopsync.com\/","name":"eShopSync","description":"Salesforce, SAP, Pardot Integration For E-Commerce Store","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/eshopsync.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/eshopsync.com\/#\/schema\/person\/2efe54edf3f05f1b1bff15ae7442c6a1","name":"Nansi Kela","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/f330d16c8f951a609b52375b27d65ca770ad3b17c39246e85f563004947de40a?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/f330d16c8f951a609b52375b27d65ca770ad3b17c39246e85f563004947de40a?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/f330d16c8f951a609b52375b27d65ca770ad3b17c39246e85f563004947de40a?s=96&d=mm&r=g","caption":"Nansi Kela"},"url":"https:\/\/eshopsync.com\/author\/nansi-kela80\/"}]}},"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/eshopsync.com\/wp-json\/wp\/v2\/posts\/350","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/eshopsync.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/eshopsync.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/eshopsync.com\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/eshopsync.com\/wp-json\/wp\/v2\/comments?post=350"}],"version-history":[{"count":4,"href":"https:\/\/eshopsync.com\/wp-json\/wp\/v2\/posts\/350\/revisions"}],"predecessor-version":[{"id":13637,"href":"https:\/\/eshopsync.com\/wp-json\/wp\/v2\/posts\/350\/revisions\/13637"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/eshopsync.com\/wp-json\/wp\/v2\/media\/499"}],"wp:attachment":[{"href":"https:\/\/eshopsync.com\/wp-json\/wp\/v2\/media?parent=350"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/eshopsync.com\/wp-json\/wp\/v2\/categories?post=350"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/eshopsync.com\/wp-json\/wp\/v2\/tags?post=350"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}