Output data according to format received (xml and json supported).