NAME
MooX::JSON_LD - Extend Moo to provide JSON-LD mark-up for your objects.
=head1 SYNOPSIS
# Your Moo (or Moose) Class
package My::Moo::Class;
use Moo;
use MooX::JSON_LD 'Person
',
# various other properties...
json_ld => 1,
);
has last_name => (
is => 'ro',
# various other properties...
json_ld => 1,
);
has birth_date => (
is => 'ro',
# various other properties...
json_ld => 'birthDate',
json_ld_serializer => sub { shift->birth_date },
);
# Then, in a program somewhere...
use My::Moo::C
MooX::Role::JSON_LD - Easily provide JSON-LD mark-up for your objects.
=head1 SYNOPSIS
# Your Moo (or Moose) Class
package My::Moo::Class;
use Moo;
with 'MooX::Role::JSON_LD';
# Various other properties
);
# Add two required methods
sub json_ld_type { 'Person' };
sub json_ld_fields { [ qw[ first_name last_name birth_date ] ] };
# Then, in a prog
int a text representation of the JSON-LD
print $obj->json_ld;
# print the raw data structure for the JSON-LD
use Data::Dumper;
print Dumper $obj->json_ld_data;
=head1 DESCRIPTION
Th