.
=over
=cut
=item DateTime::Duration::TO_JSON
This is defined here to serialize durations as postgres intervals.
=cut
sub DateTime::Duration::TO_JSON {
my $d = shift;
return DateTime::F
urn $res unless ref $names && ref $types;
# Force all bigints into numeric context for JSON. (see JSON::XS)
my %name2type = mesh @$names, @$types;
return $res unless grep /int8/, @$types