▲ | zffr 10 hours ago | |
One challenge is that JSON is for data and HTML is for UI. When a client gets JSON it can transform the data to make it ready for the UI. With HTML, the client is locked into the UI chosen by the server. What if the client wants to render the output of an API in different ways depending on what screen is visible? If the server API outputs JSON, this is trivial. If it outputs HTML the client is stuck into rendering what the server gives it. | ||
▲ | Izkata 10 hours ago | parent [-] | |
That's why GP mentioned the Accept header, the client can choose at runtime which one it wants. |