I am sending from node to my pug template a json in the response like this:
res.render("memberships", {
title: "DashRoc - Membresías",
settings: JSON.parse(req.session.settings)
});
//JSON
{
"expirepass": false,
"memberships": {"view":true}
}
but when I try to read it in pug it says that the 'view' object is not found.
if settings.memberships.view
p You have permission to see the membership
I tried to print the content of settings in the console and the result is positive, I can access the 'view' object.
script.
console.log(!{settings}) // result -> {"expirepass":false,"memberships":{"view":true}}
but in pug it won't let me access beyond 'memberships'.
settings.memberships
isundefined
. Try checking what is a type ofsettings
res.render('memberships',{'settings':JSON.parse(req.session.settings)})
andreq.session.settings
is generated from the database result where I savereq.session.settings = bdresult[0].settings
(RowDataPacket).