function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Aishwarya KotabagiAishwarya Kotabagi 

display nested json in visulaforce

hi, i was trying to display a nested json response in visualforce page via pageblocktable

public class JSON2Apex{
    public String request_tracking_id;    //12
    public cls_customers[] customers {get;set;}
    public cls_metadata metadata;
    public class cls_customers {
        public String id    {get;set;}//000131417543005
        public String status {get;set;}    //CANCELLED
        public String category {get;set;}    //OPEN MARKET
        public String line_of_business {get;set;}    //COMMERCIAL
        public String account_type {get;set;}    //master
        public String is_national_account;    //False
        public String is_central_billed;    //False
        public cls_contacts[] contacts {get;set;}
        public cls_wm_metadata wm_metadata;
    }
    public class cls_contacts {
        public String type {get;set;}    //service
        public String organization_name {get;set;}    //SAWRIDGE HOTEL
        public String name {get;set;}    //VIPUL
        public String home_phone {get;set;}    //7807997417
        public String email {get;set;}    //tboutilier@sawridge.com
        public String fax {get;set;}    //7804283335
        public cls_address address {get;set;}
        public cls_cleansed_address cleansed_address;
    }
    public class cls_address {
        public String street {get;set;}    //530 MACKENZIE BLVD
        public String street2 {get;set;}    //VIPUL
        public String city {get;set;}    //FORT MCMURRAY
        public String state {get;set;}    //AB
        public String postal_code {get;set;}    //T9H 4C8
        public String country {get;set;}    //CA
    }
    public class cls_cleansed_address {
        public String street;    //530 MACKENZIE BLVD
        public String street2;    //VIPUL
        public String city;    //FORT MCMURRAY
        public String state;    //AB
        public String postal_code;    //T9H 4C8- 
        public String country;    //CA
    }
    public class cls_wm_metadata{
        public String library;    //202A
        public String company_code;    //949
        public String mas_account_number;    //949-663
        public String mas_status;    //WRTOFFCAN
        public String business_unit;    //B00269
        public String is_canadian_billed;    //True
    }
    public class cls_metadata {
        public String totalCount;    //1
    }
    public static JSON2Apex parse(String json){
        return (JSON2Apex) System.JSON.deserialize(json, JSON2Apex.class);
    }
}
This is the visualforce page
<apex:pageBlockTable value="{!res.customers}" var="r" >
                    <apex:column headerValue="Type" value="{!r.line_of_business}"></apex:column>  
                    <apex:column headerValue="Name" value="{!r.Name}"/>
                    <apex:column headerValue="Phone" value="{!r.home_phone}"/>
                    <apex:column headerValue="Email" value="{!r.email}"/> 
                    <apex:column headerValue="ShippingAddress"/>  
                </apex:pageBlockTable> 
Best Answer chosen by Aishwarya Kotabagi
Raj VakatiRaj Vakati
Try some thing like below 
 
<apex:pageBlockTable value="{!res.customers}" var="r" >

<apex:pageBlockTable value="{!r.contacts }" var="r1" > 


 </apex:pageBlockTable>
                    


                </apex:pageBlockTable>