Correct output for jsonapi errors

Instead of using a hash map the return value now uses
a collection.