Refactor json output formatting in users controller