title: How to make an interface for API response?
body: <p>I have written API on PHP which have two different answers based on <code>success</code> status.</p>
  
  <p>First response: </p>
  
  <pre>
  {
      "success": true,
      "data": {
           "prop1": "Great, it works!"
      }
  }
  </pre>
  
  <p>Second response:</p>
  
  <pre>
  {
      "success": false,
      "data": {
           "prop2": "Something wrong!"
      }
  }
  </pre>
  
  <p>How to write the interface correctly, so that after checking success, the editor understands what kind of answer is before him?</p>