I've been using various server side languages/frameworks for developing back-end web applications. Every server-side framework that I've been using has the capability for returning views/templates (whole or part of a HTML page) as well as returning JSON responses which will then be interpreted by some front end JS. I have heard the argument that returning JSON responses as opposed to some HTML with PHP/Python/ code snippets doing tasks such as looping through collections and printing out data/HTML elements in the template creates a more complete divide between frontend and backend of the application. What are the main advantages of using JSON responses from the backend (and interpreting those JSON responses via some frontend framework) and creating a more RESTful type of application? And what are the main advantages of just returning templates/HTML to the client? 
Choice of response type in web application architecture
web development;web applications;rest;json;client server