Added in json file writing. Looks okay on initial inspection. If there's an encoding problem at the CSV level, any changes there should be reflected in the JSON, as I put the JSON write after the CSV write.