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

     use JSON::Color qw(encode_json);
     say encode_json([1, "two", {three => 4}]);

DESCRIPTION

    This module generates JSON, colorized with ANSI escape sequences.

    To change the color, see the %theme in the source code. In theory you
    can also modify it to colorize using HTML.

FUNCTIONS

 encode_json($data, \%opts) => STR

    Encode to JSON. Will die on error (e.g. when encountering
    non-encodeable data like Regexp or file handle).

    Known options:

      * pretty => BOOL (default: 0)

      Pretty-print.

      * linum => BOOL (default: 0)

      Show line number.

FAQ

 What about loading?

    Use JSON.

 How to handle non-encodeable data?

    Use Data::Clean::JSON.

SEE ALSO

    To colorize with HTML, you can try Syntax::Highlight::JSON.

    Syntax::SourceHighlight can also colorize JSON/JavaScript to HTML or
    ANSI escape. It requires the GNU Source-highlight library.