in reply to json decoding
Your data structure shows that the def member is an array, as is tr. So you want something more like:
my $result = $decoded_json->{def}[0]{tr}[0]{text};
Just remember that the square brackets show that you've got an array, and the curly braces are for a hash.
To access the syn elements, you should be able to do:
my $syn_array = $decoded_json->{def}[0]{tr}[0]{syn}; for my $rSyn (@$syn_array) { print "$rSyn->{text}, $rSyn->{pos}, $rSyn->{gen}\n"; }
which should give you something like:
volta, noun, f momento, noun, m Time, noun, m
...roboticus
When your only tool is a hammer, all problems look like your thumb.
|
|---|