Switching tasks endpoint to return JSON

Instead of marshaling to a string/byte, create a new marshaler, and marshal directly to the iowriter.