I'm using Views and Views Datasource to generate a JSON feed for my site. I've got a Video field which has both a video and a thumbnail image.
I want to include the url of the thumbnail image in my json feed. I add the Video field to my list of fields in the View and I choose the "Video thumbnail" format instead of the "Video Player" format so that it will show the thumbnail instead of the video. When I do this in a normal View it works perfectly. However, when I do it with a JSON document view, it doesn't work properly. It renders the url to the video instead of rendering the url to the thumbnail image.
I'm going to create another question which talks about how to get this to work properly, but THIS question is my backup solution.
I can rewrite the field so that it includes the fid of the thumbnail image, so my current idea is implementing a hook that will allow me to post process the rendered json or manipulate the data structure before it gets converted to json so that I can just lookup the image by its fid and then replace that piece of data in the array with the proper image url.
I have tried MANY hooks so far, but none of them provide data which represents the json data.
- hook_views_pre_view
- hook_views_pre_render
- hook_views_post_render
- hook_views_post_execute
My guess is that Views Datasource is processing the data after I've seen it in my hook implementations.
What hook can I use so manipulate the data structure before it gets converted to json or alternatively, what hook can I use to manipulate the json string after it has been converted to json?