Function 1 Which returns JSON array.
function allPlans()
{
var all_plans = {
'Stock Card Views' : {
'free':{status:true,plantext:"5 Per Month"},
'premium':{status:true,plantext:"Unlimited"},
'vip':{status:true,plantext:"5 Per Month"}
},
'Portfolio Creation' : {
'free':{status:true,plantext:"Unlimited"},
'premium':{status:true,plantext:"Unlimited"},
'vip':{status:true,plantext:"Unlimited"}
},
'Transactions In A Portfolio' : {
'free':{status:true,plantext:"Unlimited"},
'premium':{status:true,plantext:"Unlimited"},
'vip':{status:true,plantext:"Unlimited"}
},
'Advance Filter':{
'free':{status:true,plantext:"-"},
'premium':{status:true,plantext:"Full Access"},
'vip':{status:true,plantext:"Full Access"}
},
'Stock Card Requests' : {
'free':{status:true,plantext:"-"},
'premium':{status:true,plantext:"3 Per Month"},
'vip':{status:true,plantext:"3 Per Month"}
},
'Premium Posrfolio Access' : {
'free':{status:true,plantext:"-"},
'premium':{status:true,plantext:"-"},
'vip':{status:true,plantext:"1 Portfolio"}
},
'Investment Pick' : {
'free':{status:true,plantext:"-"},
'premium':{status:true,plantext:"-"},
'vip':{status:true,plantext:"1 Per Month"}
},
}
return all_plans;
}
Function 2: Used Above function in below function
function renderPlansArray()
{
var all_plans = allPlans();
var rowclass = true;
var htmltext = "";
for(var PlanName in all_plans)
{
console.log(plan_item_gray);
if (props.planname == 'free')
{
if(rowclass == true)
{
rowclass = false;
htmltext += <div className={plan_item_gray}>all_plans[PlanName]['free']['plantext']</div>;
}
else
{
rowclass = true;
htmltext += <div className={plan_item}>all_plans[PlanName]['free']['plantext']</div>;
}
}
}
return(htmltext);
}
In the above function, I have generated an HTML Text in htmltext variable and return. But when I return same like above this will return [object Object] and when I convert into a string then it will print HTML text as it is.
I want to return this variable as HTML.
I have called above function in another function to render HTML like below.
return (<div className={plan_column}>
{renderPlansArray()}
</div>)
It is returning:
AND
I need HTML LIKE:


