Using the Perl module JSON to create a JSON object



I'm having a killer time trying to create a JSON object to return to a jQuery request.

I'm trying to use the jQuery chained select module

and I'm trying to create the JSDN object using Perl's JSON module.

I have no idea what I'm doing wrong or how I can even debug it, about the best I can do is get a JS dialog box coming up with "A unknown error....".

This is all I was trying to do to create the JSON object, I thought this would be all that is needed, but it's not. Any ideas?

TIA

use JSON;
my %data = (1 => 'val1',
2 => 'val2',
3 => 'val3',
);
my $json_text = to_json(\%data);
print $json_text;