populate json results and flush on return