Added the callback functionality to the queryToStruct helper function.

The callback function allows the developer to manipulate the data
element however they wish before it is added to the struct that is
returned from the API.