Yes, if that is the goal, so that the data is especially readable by people. REST itself is not oriented towards protocols / formats, not templates.
There is not much to get here for web services, which are usually an application for communicating with applications. Computers do not care, and JSON can be fairly printed to improve legibility.
YAML is well supported by major languages, although it is not always included in standard libraries, as usual with JSON. Thus, you are likely to look for additional library dependency. In addition, if the client is a browser, parsing will be slower, since you will have to use a non-native external library, for example, described here using: JavaScript YAML Parser , Make sure it is compressed during transport or additional indent spaces expand the data size.
In addition, YAML has many esoteric and completely potentially dangerous functions. Whenever I use it, I use a "safe" parser and deactivate many, if not most of its functions, other than data structures.
I could introduce some usefulness as a debugging parameter, but maybe url.yaml or β¦?fmt=yaml to help during development. But, otherwise, there is not much benefit for all the troubles.
source share