NAME Data::Format::Pretty::JSON - Pretty-print data structure as JSON VERSION version 0.09 SYNOPSIS use Data::Format::Pretty::JSON qw(format_pretty); print format_pretty($data); Some example output: * format_pretty({a=>1, b=>2}) 1:{ 2: "a" : 1, 3: "b" : 2, 4:} By default color is turned on when interactive (unless forced off via color=>0 or environment "COLOR=0"). By default pretty printing is turned on (unless turned off via pretty=>0) and line numbers (unless turned off via when pretty=>0). By default line numbers are printed when interactive (unless turned off via by linum=>0 or environment "LINUM=0"). * format_pretty({a=>1, b=>2}, {pretty=>0}); {"a":1,"b":2} DESCRIPTION This module uses JSON to encode data as JSON. FUNCTIONS format_pretty($data, \%opts) Return formatted data structure as JSON. Options: * color => BOOL (default: 1 on interactive) Whether to enable coloring. The default is the enable only when running interactively. * pretty => BOOL (default: 1) Whether to pretty-print JSON. * linum => BOOL (default: 1 on interactive) Whether to add line numbers. The default is the enable only when running interactively. content_type() => STR Return "application/json". ENVIRONMENT COLOR => BOOL Set "color" option (if unset). LINUM => BOOL Set "linum" option (if unset). FAQ How do I turn off line numbers? You can use environment LINUM=0 or set option "linum => 0". SEE ALSO Data::Format::Pretty HOMEPAGE Please visit the project's homepage at . SOURCE Source repository is at . BUGS Please report any bugs or feature requests on the bugtracker website When submitting a bug or request, please include a test-file or a patch to an existing test-file that illustrates the bug or desired feature. AUTHOR Steven Haryanto COPYRIGHT AND LICENSE This software is copyright (c) 2014 by Steven Haryanto. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.