My naive view is that this type of thing is done so that the server returns structured data from an API call, and then the client renders it however it sees fit. If the client is a browser, then it uses HTML. If the client is curl, then it pipes it to jq, etc.
However it seems like this idea has been taken to extremes and is being overused, and applications that do this for GUI elements are probably just badly designed.