title: ValidationException errors in errors
body: <p>In grails 2.3, I want to send customized error message by JSON. But when I use </p>
  
  <pre><code>class ApiError {
      String message
      String status
      Exception error
  }
  </code></pre>
  
  <p>and try to parse it <code>as JSON</code> I get: (I ommit irrevelant message and status)</p>
  
  <pre><code>"error": {
      "cause": null
      "class": "grails.validation.ValidationException"
      "errors": {
          "errors": [1]
          0:  {
              "object": "com.example.Firm"
              "field": "context"
              "rejected-value": null
              "message": "Property [context] of class [class com.example.Firm] cannot be null"
          }
      }
      "localizedMessage": "Firm is not valid: - Field error in object 'com.example.Firm' on field 'context': rejected value [null]; codes [com.example.Firm.context.nullable.error.com.example.Firm.context,com.example.Firm.context.nullable.error.context,com.example.Firm.context.nullable.error.java.lang.String,com.example.Firm.context.nullable.error,firm.context.nullable.error.com.example.Firm.context,firm.context.nullable.error.context,firm.context.nullable.error.java.lang.String,firm.context.nullable.error,com.example.Firm.context.nullable.com.example.Firm.context,com.example.Firm.context.nullable.context,com.example.Firm.context.nullable.java.lang.String,com.example.Firm.context.nullable,firm.context.nullable.com.example.Firm.context,firm.context.nullable.context,firm.context.nullable.java.lang.String,firm.context.nullable,nullable.com.example.Firm.context,nullable.context,nullable.java.lang.String,nullable]; arguments [context,class com.example.Firm]; default message [Property [{0}] of class [{1}] cannot be null] "
      "message": "firm is not valid: - Field error in object 'com.example.Firm' on field 'context': rejected value [null]; codes [com.example.Firm.context.nullable.error.com.example.Firm.context,com.example.Firm.context.nullable.error.context,com.example.Firm.context.nullable.error.java.lang.String,com.example.Firm.context.nullable.error,firm.context.nullable.error.com.example.Firm.context,firm.context.nullable.error.context,firm.context.nullable.error.java.lang.String,firm.context.nullable.error,com.example.Firm.context.nullable.com.example.Firm.context,com.example.Firm.context.nullable.context,com.example.Firm.context.nullable.java.lang.String,com.example.Firm.context.nullable,firm.context.nullable.com.example.Firm.context,firm.context.nullable.context,firm.context.nullable.java.lang.String,firm.context.nullable,nullable.com.example.Firm.context,nullable.context,nullable.java.lang.String,nullable]; arguments [context,class com.example.Firm]; default message [Property [{0}] of class [{1}] cannot be null] "
      "stackTrace": [...143]
      "suppressed": [0]
  }
  </code></pre>
  
  <p>I do not understand; what's the point of using errors array in errors? And how to get only one errors array? 
  <a href="https://github.com/grails/grails-core/blob/v2.3.7/grails-core/src/main/groovy/grails/validation/ValidationException.java" rel="nofollow">Here</a> is a source code of this class. </p>