Flatten when JSON data is requested (JSONAPI.org compatibility)