Say I have a lot of page with ajax. Is there any convention or recommendation on the format/structure of an ajax response? Namely, if there's an error, a server returns http status 4xx or 5xx and... what structure should a json response have? Should it be with the root-level key "errors"? What structure should an an item of "error" have? Or should there be a simple array of errors? What if there was a single error?
The same goes for a successful response: should there be a root-node "data", for example? And so on.
I'm aware about jsonapi.org, for example, but it's for public REST APIs, whereas I use ajax only across my website and therefore probably I'm the only user and it should be simpler. Although, yes, possibly it can be used from other websites as well by other users.