generic response generators for json, text and xml