title: Is there any standard for JSON API response format?
body: <p>Do standards or best practices exist for structuring JSON responses from an API?  Obviously, every application's data is different, so that much I'm not concerned with, but rather the "response boilerplate", if you will.  An example of what I mean:</p>
  
  <p><strong>Successful request:</strong></p>
  
  <pre><code>{
    "success": true,
    "payload": {
      /* Application-specific data would go here. */
    }
  }
  </code></pre>
  
  <p><strong>Failed request:</strong></p>
  
  <pre><code>{
    "success": false,
    "payload": {
      /* Application-specific data would go here. */
    },
    "error": {
      "code": 123,
      "message": "An error occurred!"
    }
  }
  </code></pre>