finished parsing logic for json back to csv