Server IP : 103.119.228.120 / Your IP : 3.135.247.17 Web Server : Apache System : Linux v8.techscape8.com 3.10.0-1160.119.1.el7.tuxcare.els2.x86_64 #1 SMP Mon Jul 15 12:09:18 UTC 2024 x86_64 User : nobody ( 99) PHP Version : 5.6.40 Disable Function : shell_exec,symlink,system,exec,proc_get_status,proc_nice,proc_terminate,define_syslog_variables,syslog,openlog,closelog,escapeshellcmd,passthru,ocinum cols,ini_alter,leak,listen,chgrp,apache_note,apache_setenv,debugger_on,debugger_off,ftp_exec,dl,dll,myshellexec,proc_open,socket_bind,proc_close,escapeshellarg,parse_ini_filepopen,fpassthru,exec,passthru,escapeshellarg,escapeshellcmd,proc_close,proc_open,ini_alter,popen,show_source,proc_nice,proc_terminate,proc_get_status,proc_close,pfsockopen,leak,apache_child_terminate,posix_kill,posix_mkfifo,posix_setpgid,posix_setsid,posix_setuid,dl,symlink,shell_exec,system,dl,passthru,escapeshellarg,escapeshellcmd,myshellexec,c99_buff_prepare,c99_sess_put,fpassthru,getdisfunc,fx29exec,fx29exec2,is_windows,disp_freespace,fx29sh_getupdate,fx29_buff_prepare,fx29_sess_put,fx29shexit,fx29fsearch,fx29ftpbrutecheck,fx29sh_tools,fx29sh_about,milw0rm,imagez,sh_name,myshellexec,checkproxyhost,dosyayicek,c99_buff_prepare,c99_sess_put,c99getsource,c99sh_getupdate,c99fsearch,c99shexit,view_perms,posix_getpwuid,posix_getgrgid,posix_kill,parse_perms,parsesort,view_perms_color,set_encoder_input,ls_setcheckboxall,ls_reverse_all,rsg_read,rsg_glob,selfURL,dispsecinfo,unix2DosTime,addFile,system,get_users,view_size,DirFiles,DirFilesWide,DirPrintHTMLHeaders,GetFilesTotal,GetTitles,GetTimeTotal,GetMatchesCount,GetFileMatchesCount,GetResultFiles,fs_copy_dir,fs_copy_obj,fs_move_dir,fs_move_obj,fs_rmdir,SearchText,getmicrotime MySQL : ON | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /usr/bin/ |
Upload File : |
#!/usr/bin/perl eval 'exec /usr/bin/perl -S $0 ${1+"$@"}' if 0; # not running under some shell use strict; use Getopt::Long; use JSON::PP (); my $VERSION = '1.00'; # imported from JSON-XS/bin/json_xs my %allow_json_opt = map { $_ => 1 } qw( ascii latin1 utf8 pretty indent space_before space_after relaxed canonical allow_nonref allow_singlequote allow_barekey allow_bignum loose escape_slash ); GetOptions( 'v' => \( my $opt_verbose ), 'f=s' => \( my $opt_from = 'json' ), 't=s' => \( my $opt_to = 'json' ), 'json_opt=s' => \( my $json_opt = 'pretty' ), 'V' => \( my $version ), ) or die "Usage: $0 [-v] -f from_format [-t to_format]\n"; if ( $version ) { print "$VERSION\n"; exit; } $json_opt = '' if $json_opt eq '-'; my @json_opt = grep { $allow_json_opt{ $_ } or die "'$_' is invalid json opttion" } split/,/, $json_opt; my %F = ( 'json' => sub { my $json = JSON::PP->new; $json->$_() for @json_opt; $json->decode( $_ ); }, 'eval' => sub { my $v = eval "no strict;\n#line 1 \"input\"\n$_"; die "$@" if $@; return $v; }, ); my %T = ( 'null' => sub { "" }, 'json' => sub { my $json = JSON::PP->new; $json->$_() for @json_opt; $json->encode( $_ ); }, 'dumper' => sub { require Data::Dumper; Data::Dumper::Dumper($_) }, ); $F{$opt_from} or die "$opt_from: not a valid fromformat\n"; $T{$opt_to} or die "$opt_from: not a valid toformat\n"; local $/; $_ = <STDIN>; $_ = $F{$opt_from}->(); $_ = $T{$opt_to}->(); print $_; __END__ =pod =encoding utf8 =head1 NAME json_pp - JSON::PP command utility =head1 SYNOPSIS json_pp [-v] [-f from_format] [-t to_format] [-json_opt options_to_json] =head1 DESCRIPTION json_pp converts between some input and output formats (one of them is JSON). This program was copied from L<json_xs> and modified. The default input format is json and the default output format is json with pretty option. =head1 OPTIONS =head2 -f -f from_format Reads a data in the given format from STDIN. Format types: =over =item json as JSON =item eval as Perl code =back =head2 -t Writes a data in the given format to STDOUT. =over =item null no action. =item json as JSON =item dumper as Data::Dumper =back =head2 -json_opt options to JSON::PP Acceptable options are: ascii latin1 utf8 pretty indent space_before space_after relaxed canonical allow_nonref allow_singlequote allow_barekey allow_bignum loose escape_slash =head2 -v Verbose option, but currently no action in fact. =head2 -V Prints version and exits. =head1 EXAMPLES $ perl -e'print q|{"foo":"あい","bar":1234567890000000000000000}|' |\ json_pp -f json -t dumper -json_opt pretty,utf8,allow_bignum $VAR1 = { 'bar' => bless( { 'value' => [ '0000000', '0000000', '5678900', '1234' ], 'sign' => '+' }, 'Math::BigInt' ), 'foo' => "\x{3042}\x{3044}" }; $ perl -e'print q|{"foo":"あい","bar":1234567890000000000000000}|' |\ json_pp -f json -t dumper -json_opt pretty $VAR1 = { 'bar' => '1234567890000000000000000', 'foo' => "\x{e3}\x{81}\x{82}\x{e3}\x{81}\x{84}" }; =head1 SEE ALSO L<JSON::PP>, L<json_xs> =head1 AUTHOR Makamaka Hannyaharamitu, E<lt>makamaka[at]cpan.orgE<gt> =head1 COPYRIGHT AND LICENSE Copyright 2010 by Makamaka Hannyaharamitu This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. =cut