adding back returning the json rather than echoing it