refactor invitro to use new API for json and flat-files