Generate code using templating and JSON