Flexible time marshal/unmarshal for JSON