When using liquid variables in JavaScript, one is to add a | json filter at the end of the variable:
var myVar = {{yourLiquidVar | json}}
However, when I try to do this with a linkist object as such:
var linklist_variable = {{ linklists['footer'] | json }};
console.log(linklist_variable)
I get the following when logging to console: error: “json not allowed for this object”
I tried linklists[‘footer’].links, I tried looping the linklist object, but the error persists
How can I access linklist objects in javascript (script tags)?
P.S, I am writing the code in a custom section file