use proper JSON encoding/decoding

This commit is contained in:
Graham Knop 2009-02-10 21:41:36 +00:00
parent 7023683b48
commit bf9bd2f0d2
18 changed files with 54 additions and 54 deletions

View file

@ -502,7 +502,7 @@ sub www_view {
my $form = $session->form;
my $callback = $form->get('callback');
$callback =~ s/'/"/g;
$callback = JSON->new->utf8->decode($callback);
$callback = JSON->new->decode($callback);
my $callbackForm = '';
foreach my $param (@{$callback->{params}}) {
$callbackForm .= WebGUI::Form::hidden($session, {name=>$param->{name}, value=>$param->{value}});

View file

@ -126,7 +126,7 @@ sub get {
return {};
}
else {
return JSON->new->utf8->decode($properties{id $self}{$name});
return JSON->new->decode($properties{id $self}{$name});
}
}
return $properties{id $self}{$name};
@ -306,7 +306,7 @@ sub update {
$properties{$id}{$field} = (exists $newProperties->{$field}) ? $newProperties->{$field} : $properties{$id}{$field};
}
if (exists $newProperties->{options} && ref($newProperties->{options}) eq "HASH") {
$properties{$id}{options} = JSON->new->utf8->encode($newProperties->{options});
$properties{$id}{options} = JSON->new->encode($newProperties->{options});
}
$self->cart->session->db->setRow("cartItem","itemId",$properties{$id});
}

View file

@ -711,7 +711,7 @@ sub www_getTransactionsAsJson {
$results{'sort'} = undef;
$results{'dir'} = "desc";
$session->http->setMimeType('application/json');
return JSON->new->utf8->encode(\%results);
return JSON->new->encode(\%results);
}
#-------------------------------------------------------------------

View file

@ -98,7 +98,7 @@ sub get {
return {};
}
else {
return JSON->new->utf8->decode($properties{id $self}{$name});
return JSON->new->decode($properties{id $self}{$name});
}
}
return $properties{id $self}{$name};
@ -294,7 +294,7 @@ sub update {
$properties{$id}{$field} = (exists $newProperties->{$field}) ? $newProperties->{$field} : $properties{$id}{$field};
}
if (exists $newProperties->{options} && ref($newProperties->{options}) eq "HASH") {
$properties{$id}{options} = JSON->new->utf8->encode($newProperties->{options});
$properties{$id}{options} = JSON->new->encode($newProperties->{options});
}
$properties{$id}{lastUpdated} = WebGUI::DateTime->new($self->transaction->session,time())->toDatabase;
$self->transaction->session->db->setRow("transactionItem","itemId",$properties{$id});