Mucking around with the writeJSON function