The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

perl2json.pl : convert a Perl data structure to JSON

VERSION

Version 0.02

SYNOPSIS

    perl2json.pl -i "perl-data-structure.pl" -o "output.json" --escape-unicode --pretty

USAGE

perl2json.pl

Options:

--i filename : specify a filename which contains a Perl data structure in text representation, not as a (binary) serialised object, as one would have used in a Perl script.
--I "string" : specify a string which contains a Perl data structure in text representation, not as a (binary) serialised object. But exactly as one would have used in a Perl script.
--o outputfilename : specify the output filename to write the result to.
--escape-unicode : it will escape all unicode characters, and convert them to something like "\u0386"
--pretty : write this JSON pretty, line breaks, indendations, "the full catastrophe"

Input can be read from an input file (--i), from a string at the command line (--I) (properly quoted!), from STDIN (which also includes a file redirection json2json.pl < inputfile.json > outputfile.json

For more information see Data::Roundtrip.

AUTHOR

Andreas Hadjiprocopis, <bliako at cpan.org> / <andreashad2 at gmail.com>