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

json2perl.pl : convert JSON data to a Perl variable (dump) which can be parsed or eval'ed by any Perl script.

VERSION

Version 0.02

SYNOPSIS

    json2perl.pl -i "input.json" -o "output.perl" --no-escape-unicode --terse --no-indent

USAGE

json2perl.pl

Options:

--i filename : specify a filename which contains a JSON data structure.
--I "string" : specify a string which contains a JSON data structure.
--o outputfilename : specify the output filename to write the result to, which will be as a Perl variable, as a dump, which can be parsed or eval'ed from any Perl script.
--escape-unicode : it will escape all unicode characters, and convert them to something like "\u0386"
--terse : Terse form of output (no $VAR1)
--no-indent : do not use indentation

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 json2perl.pl < inputfile.json > outputfile.perl

For more information see Data::Roundtrip.

AUTHOR

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