.\" -*- mode: troff; coding: utf-8 -*- .\" Automatically generated by Pod::Man 5.01 (Pod::Simple 3.43) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>. .ie n \{\ . ds C` "" . ds C' "" 'br\} .el\{\ . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "CPANEL_JSON_XS 1" .TH CPANEL_JSON_XS 1 2023-07-25 "perl v5.38.0" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH NAME cpanel_json_xs \- Cpanel::JSON::XS commandline utility .SH SYNOPSIS .IX Header "SYNOPSIS" .Vb 1 \& cpanel_json_xs [\-v] [\-f inputformat] [\-t outputformat] .Ve .SH DESCRIPTION .IX Header "DESCRIPTION" \&\fIcpanel_json_xs\fR converts between some input and output formats (one of them is JSON). .PP The default input format is \f(CW\*(C`json\*(C'\fR and the default output format is \&\f(CW\*(C`json\-pretty\*(C'\fR. .SH OPTIONS .IX Header "OPTIONS" .IP \-v 4 .IX Item "-v" Be slightly more verbose. .IP "\-f fromformat" 4 .IX Item "-f fromformat" Read a file in the given format from STDIN. .Sp \&\f(CW\*(C`fromformat\*(C'\fR can be one of: .RS 4 .IP "json \- a json text encoded, either utf\-8, utf16\-be/le, utf32\-be/le" 4 .IX Item "json - a json text encoded, either utf-8, utf16-be/le, utf32-be/le" .PD 0 .IP "json-nonref \- json according to RFC 7159" 4 .IX Item "json-nonref - json according to RFC 7159" .IP "json-relaxed \- json with all relaxed options" 4 .IX Item "json-relaxed - json with all relaxed options" .IP "json-unknown \- json with allow_unknown" 4 .IX Item "json-unknown - json with allow_unknown" .IP "storable \- a Storable frozen value" 4 .IX Item "storable - a Storable frozen value" .IP "storable-file \- a Storable file (Storable has two incompatible formats)" 4 .IX Item "storable-file - a Storable file (Storable has two incompatible formats)" .IP "bencode \- uses one of Net::BitTorrent::Protocol::BEP03::Bencode, Bencode or the broken Convert::Bencode, if available (used by torrent files, among others)" 4 .IX Item "bencode - uses one of Net::BitTorrent::Protocol::BEP03::Bencode, Bencode or the broken Convert::Bencode, if available (used by torrent files, among others)" .IP "clzf \- Compress::LZF format (requires that module to be installed)" 4 .IX Item "clzf - Compress::LZF format (requires that module to be installed)" .IP "eval \- evaluate the given code as (non\-utf\-8) Perl, basically the reverse of ""\-t dump""" 4 .IX Item "eval - evaluate the given code as (non-utf-8) Perl, basically the reverse of ""-t dump""" .IP "yaml \- loose YAML (requires YAML)" 4 .IX Item "yaml - loose YAML (requires YAML)" .IP "yaml-tiny \- loose YAML (requires YAML::Tiny or CPAN::Meta::YAML)" 4 .IX Item "yaml-tiny - loose YAML (requires YAML::Tiny or CPAN::Meta::YAML)" .IP "yaml-xs \- strict YAML 1.2 (requires YAML::XS)" 4 .IX Item "yaml-xs - strict YAML 1.2 (requires YAML::XS)" .IP "yaml-syck \- YAML (requires YAML::Syck)" 4 .IX Item "yaml-syck - YAML (requires YAML::Syck)" .IP "cbor \- CBOR (via CBOR::XS)" 4 .IX Item "cbor - CBOR (via CBOR::XS)" .IP "string \- do not attempt to decode the file data" 4 .IX Item "string - do not attempt to decode the file data" .IP "sereal \- Sereal (via Sereal::Decoder)" 4 .IX Item "sereal - Sereal (via Sereal::Decoder)" .ie n .IP "none \- nothing is read, creates an ""undef"" scalar \- mainly useful with ""\-e""" 4 .el .IP "none \- nothing is read, creates an \f(CWundef\fR scalar \- mainly useful with \f(CW\-e\fR" 4 .IX Item "none - nothing is read, creates an undef scalar - mainly useful with -e" .RE .RS 4 .RE .IP "\-t toformat" 4 .IX Item "-t toformat" .PD Write the file in the given format to STDOUT. .Sp \&\f(CW\*(C`toformat\*(C'\fR can be one of: .RS 4 .IP "json, json\-utf\-8 \- json, utf\-8 encoded" 4 .IX Item "json, json-utf-8 - json, utf-8 encoded" .PD 0 .IP "json-pretty \- as above, but pretty-printed with sorted object keys" 4 .IX Item "json-pretty - as above, but pretty-printed with sorted object keys" .IP "json-stringify \- as json-pretty with allow_stringify" 4 .IX Item "json-stringify - as json-pretty with allow_stringify" .IP "json-relaxed \- as json-pretty, but with the additional options" 4 .IX Item "json-relaxed - as json-pretty, but with the additional options" .PD \&\->allow_stringify\->allow_blessed\->convert_blessed\->allow_unknown \&\->allow_tags\->\fBstringify_infnan\fR\|(1) .IP "json\-utf\-16le, json\-utf\-16be \- little endian/big endian utf\-16" 4 .IX Item "json-utf-16le, json-utf-16be - little endian/big endian utf-16" .PD 0 .IP "json\-utf\-32le, json\-utf\-32be \- little endian/big endian utf\-32" 4 .IX Item "json-utf-32le, json-utf-32be - little endian/big endian utf-32" .IP "storable \- a Storable frozen value in network format" 4 .IX Item "storable - a Storable frozen value in network format" .IP "storable-file \- a Storable file in network format (Storable has two incompatible formats)" 4 .IX Item "storable-file - a Storable file in network format (Storable has two incompatible formats)" .IP "bencode \- uses one of Net::BitTorrent::Protocol::BEP03::Bencode, Bencode or the broken Convert::Bencode, if available (used by torrent files, among others)" 4 .IX Item "bencode - uses one of Net::BitTorrent::Protocol::BEP03::Bencode, Bencode or the broken Convert::Bencode, if available (used by torrent files, among others)" .IP "clzf \- Compress::LZF format" 4 .IX Item "clzf - Compress::LZF format" .IP "yaml \- loose YAML (requires YAML)" 4 .IX Item "yaml - loose YAML (requires YAML)" .IP "yaml-tiny \- loose YAML (requires YAML::Tiny or CPAN::Meta::YAML)" 4 .IX Item "yaml-tiny - loose YAML (requires YAML::Tiny or CPAN::Meta::YAML)" .IP "yaml-xs \- strict YAML 1.2 (requires YAML::XS)" 4 .IX Item "yaml-xs - strict YAML 1.2 (requires YAML::XS)" .IP "yaml-syck \- YAML (requires YAML::Syck)" 4 .IX Item "yaml-syck - YAML (requires YAML::Syck)" .IP "dump \- Data::Dump" 4 .IX Item "dump - Data::Dump" .IP "dumper \- Data::Dumper" 4 .IX Item "dumper - Data::Dumper" .IP "string \- writes the data out as if it were a string" 4 .IX Item "string - writes the data out as if it were a string" .IP "sereal \- Sereal (via Sereal::Encoder)" 4 .IX Item "sereal - Sereal (via Sereal::Encoder)" .ie n .IP "none \- nothing gets written, mainly useful together with ""\-e""" 4 .el .IP "none \- nothing gets written, mainly useful together with \f(CW\-e\fR" 4 .IX Item "none - nothing gets written, mainly useful together with -e" .PD Note that Data::Dumper doesn't handle self-referential data structures correctly \- use "dump" instead. .RE .RS 4 .RE .IP "\-e code" 4 .IX Item "-e code" Evaluate perl code after reading the data and before writing it out again \&\- can be used to filter, create or extract data. The data that has been written is in \f(CW$_\fR, and whatever is in there is written out afterwards. .SH EXAMPLES .IX Header "EXAMPLES" .Vb 1 \& cpanel_json_xs \-t none pretty.json .Ve .PP Prettify the JSON file \fIsrc.json\fR to \fIdst.json\fR. .PP .Vb 1 \& cpanel_json_xs \-f storable\-file {"announce\-list"}}\*(Aq \-t string .Ve .PP Print the tracker list inside a torrent file. .PP .Vb 1 \& lwp\-request http://cpantesters.perl.org/show/Cpanel\-JSON\-XS.json | cpanel_json_xs .Ve .PP Fetch the cpan-testers result summary \f(CW\*(C`Cpanel::JSON::XS\*(C'\fR and pretty-print it. .PP .Vb 4 \& cpanel_json_xs \-f yaml\-xs \-t yaml\-tiny MYMETA.yml \& cpanel_json_xs \-f yaml\-tiny \-t yaml\-xs XSMETA.yml \& cpanel_json_xs \-f yaml \-t yaml .SH AUTHOR .IX Header "AUTHOR" Copyright (C) 2008 Marc Lehmann Copyright (C) 2016 Cpanel Inc