Test JSON as Perl object, not string.

If `$hashref` has multiple key-value pairs, `json->encode($hashref)`
returns unpredictable output from Perl 5.18, because of hash
randomization. So I think that it is not good test as string.

This fixes #1 issue