Build json and cfg from template