title: Object to JSON serialization inside thymeleaf template
body: <p>Is there a way in thymeleaf to output json of an object from the context. I can do it inside the controller but don't really want to.</p>
  
  <p>Controller:</p>
  
  <pre><code>@RequestMapping("/{projectId}/edit")
  public String editProject(Model model, @PathVariable Long projectId) {
      Project project = projectRepo.findOne(projectId);
      // Below line works, but I want to put the object to the model
      // model.addAttribute("project", new ObjectMapper().writeValueAsString(project));
      model.addAttribute("project", project);
      return "project/edit";
  }
  </code></pre>
  
  <p>Partial Template:</p>
  
  <pre><code>&lt;script&gt;
      var app = new Vue({
          el: '#app',
          data: {
              project: [(${project})]
          }
      });
  &lt;/script&gt;
  </code></pre>