Koha::Object::JSONFields - Class that adds JSON field manipulation helper methods for Koha::Object-derived classes
use base qw(Koha::Object Koha::Object::JSONFields);
my $object = Koha::Object->new({ property1 => $property1, property2 => $property2, etc... } );
my $field_name_hashref = $object->decode_json_field({ field => 'field_name' });
$object->encode_json_field({ field => 'field_name', data => $data });
my $hashref = $object->decode_json_field({ field => 'field_name' });
Returns a data structure representing the JSON-decoded value of field field_name.
$object->set_encoded_json_field(
{ data => $data,
field => 'field_name',
}
);
Sets a JSON string encoded representation of $data into the object's field_name attribute.
my $JSON_object = $self->_json;
Returns a JSON object with utf8 disabled. Encoding to UTF-8 should be done later.
Tomas Cohen Arazi, <tomascohen@theke.io>