Added code to write XOD as JSON