correctly return json or text or not on all functions