package RDF::Server::Formatter::JSON;
use Moose;
with 'RDF::Server::Formatter';
use MooseX::Types::Moose qw(ArrayRef Str);
use RDF::Server::Constants qw(:ns);
use JSON::Any;
use RDF::Server::Excepti
communicate the mime type
our $JSON = JSON::Any -> new;
sub wants_rdf { 0 }
###
# Entry / Resource formatting
###
sub resource { return ( 'application/json', $JSON -> encode($_[1]) ); }
sub to_r
y $data = $JSON -> decode( $content );
# now make RDF from the data structure
}
###
# List formatting
###
sub feed {
my($self, @list) = @_;
return( 'application/json', $JSON -> encode(
data {
my($self) = @_;
# we want to return a hashref tree of ourselves
# useful for JSON and other data structure style formats
my $data = XML::Simple::XMLin($self -> fetch, NSExpan
urce handler will pass in a Perl data structure. Rendering
to data serialization formats such as JSON or YAML will probably prefer
a data structure instead of RDF.
=item resource : Str
This return
dering.
The available formatters are:
L<RDF::Server::Formatter::Atom>,
L<RDF::Server::Formatter::JSON>,
L<RDF::Server::Formatter::RDF>.
=for readme stop
=head1 SERVER CONFIGURATION
An RDF::Server