added Response formats XML and CSV; fixed JSON encoding