May I suggest introducing schema validation by using the official [jsonapi schema](http://jsonapi.org/faq/#is-there-a-json-schema-describing-json-api) and a library like https://github.com/justinrainbow/json-schema ?