changed signature of asJson helper