working csv and json output