The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Data::Object::Json

ABSTRACT

Data-Object Json Class

SYNOPSIS

  use Data::Object::Json;

  my $json = Data::Object::Json->new;

  my $data = $json->from($arg);

DESCRIPTION

Data::Object::Json provides methods for reading and writing JSON data.

METHODS

This package implements the following methods.

dump

  # given $json

  my $string = $json->dump($data);

  # '{"foo":...}'

The dump method converts a data structure into a JSON string.

from

  # given $json

  my $data = $json->from($string);

  # {,...}

  my $string = $json->from($data);

  # '{"foo":...}'

The from method calls dump or load based on the give data.

load

  # given $json

  my $data = $json->load($string);

  # {,...}

The load method converts a string into a Perl data structure.

read

  # given $json

  my $data = $json->read($file);

  # {,...}

The read method reads JSON from the given file and returns a data structure.

write

  # given $json

  my $string = $json->write($file, $data);

  # ...

The write method writes the given data structure to a file as a JSON string.

space

  # given $json

  my $space = $json->space();

  # JSON::Tiny

The space method returns a Data::Object::Space object for the origin.

file

  # given $json

  my $path = $json->file($file);

  # ...

The file method returns a Data::Object::Path object for the given file.

origin

  # given $json

  my $origin = $json->origin();

  # JSON::Tiny

The origin method returns the package name of the underlying JSON library used.