write json incrementally
flush data structure after each record (which is written out incrementally)