add method to convert date to json string