NAME
    Error::Pure::Output::JSON - Output JSON subroutines for Error::Pure.

SYNOPSIS
     use Error::Pure::Output::JSON qw(err_json);
     print err_json(@errors);

SUBROUTINES
    "err_json(@errors)"
             JSON print of backtrace.
             When is set global variable $PRETTY, print pretty output.
             Returns JSON serialization of backtrace.

VARIABLES
    $PRETTY
             JSON pretty output flag. Possible values are 0 or 1.
             Default value is 0.

EXAMPLE1
     # Pragmas.
     use strict;
     use warnings;

     # Modules.
     use Error::Pure::Output::JSON qw(err_json);

     # Fictional error structure.
     my $err_hr = {
             'msg' => [
                     'FOO',
                     'KEY',
                     'VALUE',
             ],
             'stack' => [
                     {
                             'args' => '(2)',
                             'class' => 'main',
                             'line' => 1,
                             'prog' => 'script.pl',
                             'sub' => 'err',
                     }, {
                             'args' => '',
                             'class' => 'main',
                             'line' => 20,
                             'prog' => 'script.pl',
                             'sub' => 'eval {...}',
                     }
             ],
     };

     # Print out.
     print err_json($err_hr);

     # Output:
     # {"msg":["FOO","KEY","VALUE"],"stack":[{"sub":"err","prog":"script.pl","args":"(2)","class":"main","line":1},{"sub":"eval {...}","prog":"script.pl","args":"","class":"main","line":20}]}

EXAMPLE2
     # Pragmas.
     use strict;
     use warnings;

     # Modules.
     use Error::Pure::Output::JSON qw(err_json);

     # Set pretty output.
     $Error::Pure::Output::JSON::PRETTY = 1;

     # Fictional error structure.
     my $err_hr = {
             'msg' => [
                     'FOO',
                     'KEY',
                     'VALUE',
             ],
             'stack' => [
                     {
                             'args' => '(2)',
                             'class' => 'main',
                             'line' => 1,
                             'prog' => 'script.pl',
                             'sub' => 'err',
                     }, {
                             'args' => '',
                             'class' => 'main',
                             'line' => 20,
                             'prog' => 'script.pl',
                             'sub' => 'eval {...}',
                     }
             ],
     };

     # Print out.
     print err_json($err_hr);

     # Output:
     # {
     #    "msg" : [
     #       "FOO",
     #       "KEY",
     #       "VALUE"
     #    ],
     #    "stack" : [
     #       {
     #          "sub" : "err",
     #          "prog" : "script.pl",
     #          "args" : "(2)",
     #          "class" : "main",
     #          "line" : 1
     #       },
     #       {
     #          "sub" : "eval {...}",
     #          "prog" : "script.pl",
     #          "args" : "",
     #          "class" : "main",
     #          "line" : 20
     #       }
     #    ]
     # }

DEPENDENCIES
    Exporter, JSON, Readonly.

SEE ALSO
    Error::Pure, Error::Pure::Output::Text.

REPOSITORY
    <https://github.com/tupinek/Error-Pure-Output-JSON>

AUTHOR
    Michal Špaček <mailto:skim@cpan.org>

    <http://skim.cz>

LICENSE AND COPYRIGHT
    BSD license.

VERSION
    0.09