Пример #1
0
// MarshalJSON implements json.Marshaler for TransitDetails. This encodes Go
// types back to the API representation.
func (transitDetails *TransitDetails) MarshalJSON() ([]byte, error) {
	x := encodedTransitDetails{}
	x.safeTransitDetails = safeTransitDetails(*transitDetails)

	x.EncArrivalTime = internal.NewDateTime(transitDetails.ArrivalTime)
	x.EncDepartureTime = internal.NewDateTime(transitDetails.DepartureTime)

	return json.Marshal(x)
}
Пример #2
0
// MarshalJSON implements json.Marshaler for Leg. This encodes Go types back to
// the API representation.
func (leg *Leg) MarshalJSON() ([]byte, error) {
	x := encodedLeg{}
	x.safeLeg = safeLeg(*leg)

	x.EncDuration = internal.NewDuration(leg.Duration)
	x.EncDurationInTraffic = internal.NewDuration(leg.DurationInTraffic)
	x.EncArrivalTime = internal.NewDateTime(leg.ArrivalTime)
	x.EncDepartureTime = internal.NewDateTime(leg.DepartureTime)

	return json.Marshal(x)
}