convert datetime string into json string, or oppositely