#!/usr/bin/perl -- use strict; use warnings; use JavaScript::HashRef::Decode qw/ decode_js /; my $string = q{'https\x3a\x2f\x2fexample.com'}; my $js_hash = "{it:$string}";; my $fromJs = decode_js( $js_hash ) ; dd( $string, $js_hash, $fromJs ); dd( $fromJs->{it} ); __END__ ( "'https\\x3a\\x2f\\x2fexample.com'", "{it:'https\\x3a\\x2f\\x2fexample.com'}", { it => "https://example.com" }, ) "https://example.com"