eturn
"Usage : $0 [--I 'a-json-string' | --i 'afile.json'] [--o afile] [--(no-)escape-unicode|-e] [--(no-)pretty] [--(no-)terse] [--(no-)indent]\n"
."\nIt will read a JSON string from command line (
TDIN> }
}
my $result = Data::Roundtrip::json2dump($INPUT_STRING, \%params);
if( ! defined $result ){ print STDERR "$0 : error, call to ".'Data::Roundtrip::json2dump()'." has failed.\n"; exit(1) }
if
NAME
json2perl.pl : convert JSON data to a Perl variable (dump) which can be parsed or eval'ed by any Perl script.
=head1 VERSION
Version 0.30
=head1 SYNOPSIS
json2perl.pl -i "input.json" -o
g unicode escaped and rendered at will.
use Encode qw/encode_utf8 decode_utf8/;
use JSON qw/decode_json encode_json/;
use Unicode::Escape qw/escape unescape/;
# YAML v1.30 fails for {"\"aaa'bbb" => "
lehandle};
my @io = (@file, @fh);
my @json = qw{perl2json json2perl json2dump json2yaml json2json jsonfile2perl};
my @yaml = qw{perl2yaml yaml2perl yaml2json yaml2dump yaml2yaml yamlfile2perl};
my
p_filtered perl2dump_homebrew};
# these have now (v0.28) been removed from @dump: dump2perl dump2json dump2yaml dump2dump
# they need to be explicitly imported *individually*
# because of the dange
sub usage { return
"Usage : $0 [--I 'a-json-string' | --i 'afile.json'] [--o afile] [--(no-)escape-unicode|-e] [--(no-)pretty|-p]\n"
."\nIt will read a JSON string from command line (-I), or from a
ware 4K limit on linux terminal, see CAVEATS for workaround).\n"
."It will print its contents as JSON to STDOUT or to a file (--o).\n"
."It can escape/un-escape unicode characters (--escape-unicode)
N> }
}
my $result = Data::Roundtrip::json2json($INPUT_STRING, \%params);
if( ! defined $result ){ print STDERR "$0 : error, call to ".'Data::Roundtrip::json2jsonl()'." has failed.\n"; exit(1) }
if(
}
}
my $result = Data::Roundtrip::yaml2json($INPUT_STRING, \%params);
if( ! defined $result ){ print STDERR "$0 : error, call to ".'Data::Roundtrip::yaml2jsonl()'." has failed.\n"; exit(1) }
if( de
aml2json.pl : convert YAML to JSON with formatting options
=head1 VERSION
Version 0.30
=head1 SYNOPSIS
yaml2json.pl -i "input.yaml" -o "output.json" --escape-unicode --pretty
yaml2json.pl
-e < "input.yaml" > "output.json"
# press CTRL-D when done typing YAML to STDIN
# input must be less than 4K long!
yaml2json.pl
# Read input from clipboard or write output to clipbo
=> 0,
);
sub usage { return
"Usage : $0 [--I 'a-perl-var-as-string' | --i 'afile.pl'] [--o afile.json] [--(no-)escape-unicode|-e] [--(no-)pretty]\n"
."\nIt will read a Perl variable as a string from
om STDIN (beware 4K limit on linux terminal, see CAVEATS for workaround).\n"
."It will print its JSON equivalent to STDOUT or to a file (--o).\n"
."It can optionally escape unicode characters (--esc
}
}
my $result = Data::Roundtrip::dump2json($INPUT_STRING, \%params);
if( ! defined $result ){ print STDERR "$0 : error, call to ".'Data::Roundtrip::dump2jsonl()'." has failed.\n"; exit(1) }
if( de
r pbpaste (on OSX))
json2json.pl -e < $(xclip -o)
json2json.pl -e < $(pbaste)
# write the output to the clipboard for further pasting
json2json.pl -i input.json | xclip -i
# clicki
ported
);
sub usage { return
"Usage : $0 [--I 'a-json-string' | --i 'afile.json'] [--o afile] [--(no-)escape-unicode|-e]\n"
."\nIt will read a JSON string from command line (-I), or from a file (-i
TDIN> }
}
my $result = Data::Roundtrip::json2yaml($INPUT_STRING, \%params);
if( ! defined $result ){ print STDERR "$0 : error, call to ".'Data::Roundtrip::json2yaml()'." has failed.\n"; exit(1) }
if
AME
json2yaml.pl : convert JSON to YAML with formatting options.
=head1 VERSION
Version 0.30
=head1 SYNOPSIS
json2yaml.pl -i "input.json" -o "output.yaml" --(no-)escape-unicode
json2yaml