n00b question: what is the best practice to generate some js in the controller and send it down to the view template?

At the moment I'm relying on plain string concatenation

...
  results ~= [format(
    "[%s,%s],",
    object.getTimestamp(),
    object.getValue()
  )]; 
...
string json_results = "[";
foreach(result; results) {
  json_results ~= result;
}
json_results ~= "]";

and in the template

script.
  data : !{json_results},

I'm sure there is a better way to do this but couldn't find any detail anywhere in vibe.d or jade docs.

Thanks,
dat