Without seeing your actual data (e.g. use Data::Dumper; $Data::Dumper::Useqq=1; print Dumper $record;
) and what SHA you expect, it is hard to help.
That said, you may find the easiest way to get a consistent SHA is to force the json encoding to output only ASCII and make sure it always puts hash elements in a consistent order:
use JSON;
$serialized = JSON::to_json( $data_structure, { 'ascii' => 1, 'canonical' => 1 } );