I read out a data-attibute, then I want to convert the string "true" into a boolean. At the moment I have to do a comparison in the javascript, is there a better way to do it? I don't know how to use this solution
HTML
<div data-nav='{ "nav": "true"}'>
JS
var data = JSON.parse($nav.attr('data-nav').toString());
data.nav = (data.nav === "true") ? true : false;