I am trying to pass json data via html attribute in vue.js.
<div id="app" data-number="2" data-json="{"name":"John", "age":30, "car":null}"></div>
in my main.js file
new Vue({
el: `#app`,
render: h => h(App,{
props:{
myNumber: this.dataset.number,
myData: this.dataset.json
}
})
})
if I do console log for console.log(this.dataset.number) I get 2 which is correct but when I do console log for myData I just get { and it doesnt get the right json data. Any idea how to pass jason data to vue instance?