Consolidate input type and detect XML or JSON