Standard JSON API Antwortformat?
Gibt es Standards oder Best Practices für die Strukturierung von JSON-Antworten aus einer API? Offensichtlich sind die Daten jeder Anwendung unterschiedlich, so dass es mir nicht um vieles geht, sondern um das "Antwort-Boilerplate", wenn Sie so wollen. Ein Beispiel für das, was ich meine:
Erfolgreiche Anfrage:
{
"success": true,
"payload": {
/* Application-specific data would go here. */
}
}
Anfrage fehlgeschlagen:
{
"success": false,
"payload": {
/* Application-specific data would go here. */
},
"error": {
"code": 123,
"message": "An error occurred!"
}
}