Update template to use the new DTO object instead of relying on the old system
Fix several smaller issues in the JSON category tree creation code