Update json2csv.js

added null-check