handled time serialisation to JSON