This is my VF code, which runs on onclick
<script>
function func(data)
{
$Lightning.use("c:testingFromVFtoLightningApp", function(){
$Lightning.createComponent("c:testingFromVFtoLightning",
{listoFRecords:'{!duplicateRecords}'},
"lightning",
function(){});
});
}
Whereas duplicateRecords is of type List<DuplicateRecordsWrapper>
When i click on the button above code runs & successfully sent the data to Lightning Component. Here the problem is i could not able to Iterate over the wrapper class which is being sent from VF page (tried too many ways), But i had done so many times iterating over the wrapper classes as a response coming from AuraEnabledmethods. Why the both are different from each other. Please find the below screenshot which display {!v.listoFRecords} response.
Lightning.cmp
<aura:component >
<aura:attribute access="public" name="listoFRecords" type="leadConvertController.DuplicateRecordsWrapper[]"/>
<div class="slds-card__body">
<aura:if isTrue="{!!empty(v.listoFRecords)}">
{!v.listoFRecords}<br/>
{!v.listoFRecords[0].DuplicateRecordsWrapper}
<table class=" slds-table slds-table--bordered slds-max-medium-table--stacked-horizontal slds-table_col-bordered" role="grid">
<thead>
<tr class="headercolour cGeneric_Table_Component" scope="row">
<th class="slds-is-resizable slds-table_resizable-cols headerCell" scope="col" >Account Name</th>
</tr>
</thead>
<tbody>
<aura:iteration var="suc" items="{!v.listoFRecords}">
<tr class="slds-hint-parent">
<td role="gridcell" >
<div class="slds-truncate dataCell" >{!suc.accountName}</div>
</td>
</tr>
</aura:iteration>
</tbody>
</table>
</aura:if>
</div>
</aura:component>
Edited:
[DuplicateRecordsWrapper:[accountId=001K000001SzRcBIAV, accountName=qweryhtj, city=Banglore, country=India, criteriaBasedOn=Duplicate Match, matchConfidence=51.0, message=Fuzzy Match, selectedRecord=false, state=Karnataka, street=S sankalp apartment,Neeladri Nagar, zipCode=560100], DuplicateRecordsWrapper:[accountId=001K000001SzRoCIAV, accountName=qweryhtj, city=Banglore, country=India, criteriaBasedOn=Duplicate Match, matchConfidence=51.0, message=Fuzzy Match, selectedRecord=false, state=Karnataka, street=S sankalp apartment,Neeladri Nagar, zipCode=560100], DuplicateRecordsWrapper:[accountId=001K000001SzRraIAF, accountName=qweryhtj, city=Banglore, country=India, criteriaBasedOn=Duplicate Match, matchConfidence=51.0, message=Fuzzy Match, selectedRecord=false, state=Karnataka, street=S sankalp apartment,Neeladri Nagar, zipCode=560100], DuplicateRecordsWrapper:[accountId=001K000001SzSKqIAN, accountName=qweryhtj, city=Banglore, country=India, criteriaBasedOn=Duplicate Match, matchConfidence=51.0, message=Fuzzy Match, selectedRecord=false, state=Karnataka, street=S sankalp apartment,Neeladri Nagar, zipCode=560100], DuplicateRecordsWrapper:[accountId=001K000001SzSPSIA3, accountName=qweryhtj, city=Banglore, country=India, criteriaBasedOn=Duplicate Match, matchConfidence=51.0, message=Fuzzy Match, selectedRecord=false, state=Karnataka, street=S sankalp apartment,Neeladri Nagar, zipCode=560100], DuplicateRecordsWrapper:[accountId=001K000001SzSUNIA3, accountName=qweryhtj, city=Banglore, country=India, criteriaBasedOn=Duplicate Match, matchConfidence=51.0, message=Fuzzy Match, selectedRecord=false, state=Karnataka, street=S sankalp apartment,Neeladri Nagar, zipCode=560100], DuplicateRecordsWrapper:[accountId=001K000001T26bIIAR, accountName=qweryhtj, city=Banglore, country=India, criteriaBasedOn=Duplicate Match, matchConfidence=51.0, message=Fuzzy Match, selectedRecord=false, state=Karnataka, street=S sankalp apartment,Neeladri Nagar, zipCode=560100], DuplicateRecordsWrapper:[accountId=001K000001T26egIAB, accountName=qweryhtj, city=Banglore, country=India, criteriaBasedOn=Duplicate Match, matchConfidence=51.0, message=Fuzzy Match, selectedRecord=false, state=Karnataka, street=S sankalp apartment,Neeladri Nagar, zipCode=560100], DuplicateRecordsWrapper:[accountId=001K000001T26elIAB, accountName=qweryhtj, city=Banglore, country=India, criteriaBasedOn=Duplicate Match, matchConfidence=51.0, message=Fuzzy Match, selectedRecord=false, state=Karnataka, street=S sankalp apartment,Neeladri Nagar, zipCode=560100], DuplicateRecordsWrapper:[accountId=001K000001T6nfoIAB, accountName=qweryhtj, city=Banglore, country=India, criteriaBasedOn=Duplicate Match, matchConfidence=51.0, message=Fuzzy Match, selectedRecord=false, state=Karnataka, street=S sankalp apartment,Neeladri Nagar, zipCode=560100]]
Wrapper Class Code
public class DuplicateRecordsWrapper{
public boolean selectedRecord{get;set;}
public string matchConfidence{get;set;}
public string criteriaBasedOn{get;set;}
public string accountId{get;set;}
@AuraEnabled
public string accountName{get;set;}
public string country{get;set;}
public string street{get;set;}
public string state{get;set;}
public string city{get;set;}
public string zipCode{get;set;}
public string message{get;set;}
}