Fix JSON, and ordering in the table.
This commit is contained in:
parent
3c7e7ab231
commit
996e3a7053
1 changed files with 5 additions and 1 deletions
|
|
@ -143,10 +143,14 @@ sub www_getFriendsAsJson {
|
|||
friends => $friendsCount,
|
||||
};
|
||||
}
|
||||
@records = map { $_->[1] }
|
||||
sort { $a->[0] cmp $b->[0] }
|
||||
map { [ $_->{username}, $_ ] } @records;
|
||||
my %results;
|
||||
$results{totalRecords} = scalar @records;
|
||||
$results{records} = \@records;
|
||||
#$results{'sort'} = undef;
|
||||
$results{'sort'} = 'username';
|
||||
$self->bare(1);
|
||||
$session->http->setMimeType('application/json');
|
||||
my $json = JSON::to_json(\%results);
|
||||
return $json;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue