In this post, I am going to share the information how to generate the JSON and display the same in Visual Force page in tabular format.
JSON ( Java Script Object Notation )
1. JSON has a smaller footprint than XML, which means it can be transmitted and parsed faster than XML.
2. JSON.serialize() is used to generate JSON.
3. It Simply have a key and value pair combination.
4. DataTypes supported by the JSON are “Number, String, Boolean, Array, Object and null”.
5. Key and value pair are separated by colon “:”
6. Object is enclosed between curly brackets “{” and “}”.
7. Array is enclosed using square bracket “[“, “]” separated by the comma.
Serialization and Deserialization
Apex Code :
public with sharing class jsongenerator { public string jsondata{get;set;} public list<jsonvalue> jsonstring { get; set; } public jsongenerator(){ string soql ='select name,industry from account'; List<Account> acct = Database.Query(soql); jsondata = JSON.serialize(acct); jsonstring = (List<jsonvalue>) System.JSON.deserialize(jsondata , List<jsonvalue>.class); } public class jsonvalue{ public String name{get;set;} public String industry{get;set;} } }
Visualforce Page:
<apex:page controller="jsongenerator" showHeader="false"> {!jsondata} <apex:pageblock > <apex:pageblockTable value="{!jsonstring}" var="json"> <apex:column headerValue="Name" value="{!json.name}"/> <apex:column headerValue="Industry" value="{!json.industry}"/> </apex:pageblockTable> </apex:pageblock> </apex:page>
Json Data in Pageblock Table

Support
That’s all forGenerate JSON data and Convert in PageBlockTable in Salesforce, still have any issue feel free to add a ticket and let us know your views to make the product better http://webkul.com/ticket/index.php