Grape Error Formatter

I was working with Grape API, and I use a custom error formatter. Since we are working on generating error objects according to JSON API specification format:

Here is an official example [source]

HTTP/1.1 422 Unprocessable Entity
Content-Type: application/vnd.api+json

{
  "errors": [
    {
      "status": "422",
      "source": { "pointer": "/data/attributes/first-name" },
      "title":  "Invalid Attribute",
      "detail": "First name must contain at least three characters."
    }
  ]
}

d But we also want to add

So even though the field jsonapi is not required, we would like to have it in our response. So our response would be like this:

{
"jsonapi": {
"version": "1.0"
},
  "errors": [
    {
      "status": "422",
      "source": { "pointer": "/data/attributes/first-name" },
      "title":  "Invalid Attribute",
      "detail": "First name must contain at least three characters."
    }
  ]
}