When I do
$.each(result, function(i, n){
alert("key: " + i + ", Value: " + n );
});
then for each iteration I see
key: 276, Value: {"owners":["he"],"users":["he","m"],"end":"07/06-2011","groups":[],"type":"in"}
How do I access the values of owners, users, end, groups, and type for each iteration?
In Perl would I have done
foreach my $key (keys %result) {
   print $result{$key}{owners};
   print $result{$key}{users};
   ...
}
Update
I get result from JSON like so
$.ajax({
    type: "GET",
    url: "/cgi-bin/ajax.pl",
    contentType: "application/json; charset=utf-8",
    dataType: "json",
    data: { "cwis" : id },
    // ...
    success: function(result){
    if (result.error) {
        alert('result.error: ' + result.error);
    } else {
        $.each(result, function(i, n){
        alert( "key: " + i + ", Value: " + n );
        });
    }
    }
});
Update 2
It seams that the problem is the server side is not sending prober JSON.
This is the server side script that generate the JSON string.
!/usr/bin/perl -T
use CGI;
use CGI::Carp qw(fatalsToBrowser);
use CGI qw(:standard);
use JSON;
use utf8;
use strict;
use warnings;
my $cgi = CGI->new;
$cgi->charset('UTF-8');
my $json_string = qq{{"error" : "The user do not have any activities."}};
my $json = JSON->new->allow_nonref;
$json = $json->utf8;
# @a and $act is now available
my $data;
foreach my $id (@a) {
    $data->{$id} = $json->encode(\%{$act->{$id}});
}
$json_string = to_json($data);
print $cgi->header(-type => "application/json", -charset => "utf-8");
print $json_string;
 
     
     
     
    