Jifty::Filter::JSON - This filter stores arbitrary Perl via JSON
use Jifty::DBI::Record schema { column my_data => type is 'text', filters are qw/ Jifty::Filter::JSON /; }; my $thing = __PACKAGE__->new; $thing->create( my_data => { foo => 'bar', baz => [ 1, 2, 3 ] } ); my $my_data = $thing->my_data; while (my ($key, $value) = %$my_data) { # do something... }
This filter provides the ability to store arbitrary data structures into a database column using JSON. This is very similar to the Jifty::DBI::Filter::Storable filter except that the JSON format remains human-readable in the database. You can store virtually any Perl data, scalar, hash, or array into the database using this filter.
In addition, JSON (at least the storage of scalars, hashes, and arrays) is compatible with data structures written in other languages, so you may store or read data between applications written in different languages.
This method is used to encode the Perl data structure into JSON formatted text.
This method is used to decode the JSON formatted text from the database into the Perl data structure.
Jifty::DBI::Filter, Jifty::JSON
Luke Closs <cpan@5thplane.com>
This program is free software and may be modified or distributed under the same terms as Perl itself.
To install Jifty, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Jifty
CPAN shell
perl -MCPAN -e shell install Jifty
For more information on module installation, please visit the detailed CPAN module installation guide.