func (transitDetails *TransitDetails) UnmarshalJSON(data []byte) error {
	x := encodedTransitDetails{}
	err := json.Unmarshal(data, &x)
	if err != nil {
		return err
	}
	*transitDetails = TransitDetails(x.safeTransitDetails)
	transitDetails.ArrivalTime = x.EncArrivalTime.Time()
	transitDetails.DepartureTime = x.EncDepartureTime.Time()
	return nil
}
UnmarshalJSON implements json.Unmarshaler for TransitDetails. This decodes
the API representation into types useful for Go developers.
package maps
import (
	"encoding/json"
	"net/url"
	"googlemaps.github.io/maps/internal"
)
type safeLeg Leg
type encodedLeg struct {
	safeLeg
	EncDuration          *internal.Duration `json:"duration"`
	EncDurationInTraffic *internal.Duration `json:"duration_in_traffic"`
	EncArrivalTime       *internal.DateTime `json:"arrival_time"`
	EncDepartureTime     *internal.DateTime `json:"departure_time"`
}
func (leg *Leg) UnmarshalJSON(data []byte) error {
	x := encodedLeg{}
	err := json.Unmarshal(data, &x)
	if err != nil {
		return err
	}
	*leg = Leg(x.safeLeg)
	leg.Duration = x.EncDuration.Duration()
	leg.DurationInTraffic = x.EncDurationInTraffic.Duration()
	leg.ArrivalTime = x.EncArrivalTime.Time()
	leg.DepartureTime = x.EncDepartureTime.Time()
	return nil
}
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)
}
type safeStep Step
type encodedStep struct {
	safeStep
	EncDuration *internal.Duration `json:"duration"`
}
func (step *Step) UnmarshalJSON(data []byte) error {
	x := encodedStep{}
	err := json.Unmarshal(data, &x)
	if err != nil {
		return err
	}
	*step = Step(x.safeStep)
	step.Duration = x.EncDuration.Duration()
	return nil
}
func (step *Step) MarshalJSON() ([]byte, error) {
	x := encodedStep{}
	x.safeStep = safeStep(*step)
	x.EncDuration = internal.NewDuration(step.Duration)
	return json.Marshal(x)
}
type safeTransitDetails TransitDetails
type encodedTransitDetails struct {
	safeTransitDetails
	EncArrivalTime   *internal.DateTime `json:"arrival_time"`
	EncDepartureTime *internal.DateTime `json:"departure_time"`
}