I have the following code , which logs the json if I use a console.log, but I want to save it in the jsonBlocks variable. But it won't work. I guess its because of async stuff, but I cant find a way to solve it.
var jsonBlocks;
fetch('https://myurl')
.then(res => res.text())
.then(body => this.jsonBlocks = body )