DBIx-QuickORM

 view release on metacpan or  search on metacpan

lib/DBIx/QuickORM/Type/JSON.pm  view on Meta::CPAN

        else                  { die "Not sure what to do with $val" }
    }

    return $class->JSON->encode($val);
}

sub qorm_compare {
    my $class = shift;
    my ($a, $b) = @_;

    # First decode the json if it is not already decoded
    $a = $class->qorm_inflate($a);
    $b = $class->qorm_inflate($b);

    # Now encode it in canonical form so that identical structures produce identical strings.
    # Another option would be to use Test2::Compare...
    $a = $class->CJSON->encode($a);
    $b = $class->CJSON->encode($b);

    return $a cmp $b;
}



( run in 0.440 second using v1.01-cache-2.11-cpan-e9daa2b36ef )