man > cpanel_json_xs(1p)

๐Ÿ“‹ NAME

cpanel_json_xs โ€” Cpanel::JSON::XS commandline utility

๐Ÿš€ Quick Reference

Use CaseCommandDescription
๐Ÿ” JSON Lint / Validatecpanel_json_xs -t none <file.jsonValidates a JSON file; exits with non-zero status on error
โœจ Pretty-print JSONcpanel_json_xs <src.json >pretty.jsonReads JSON and writes a pretty-printed version
๐Ÿ”„ Convert Storable to JSONcpanel_json_xs -f storable-file <fileReads a Storable file and outputs human-readable JSON
๐Ÿ”„ Convert Storable to YAMLcpanel_json_xs -f storable-file -t yaml <fileReads Storable and outputs YAML
๐Ÿงช Generate JSON from Perlcpanel_json_xs -f none -e '$_ = [1, 2, 3]'Outputs a Perl array as UTF-8 JSON
๐ŸŒ Fetch & pretty-print remote JSONlwp-request URL | cpanel_json_xsPipes HTTP response JSON through the pretty-printer
๐Ÿ“ฆ Extract torrent tracker listcpanel_json_xs -f bencode -e '$_ = join "\n", map @$_, @{$_->{"announce-list"}}' -t stringReads a bencoded torrent file and prints the tracker list
๐Ÿ”„ YAML format round-trip comparisoncpanel_json_xs -f yaml-xs -t yaml-tiny <META.yml >MYMETA.ymlConverts between YAML::XS and YAML::Tiny formats

๐Ÿ“– SYNOPSIS

cpanel_json_xs [-v] [-f inputformat] [-t outputformat]

๐Ÿ“ DESCRIPTION

cpanel_json_xs converts between some input and output formats (one of them is JSON).

The default input format is "json" and the default output format is "json-pretty".

โš™๏ธ OPTIONS

-v ๐Ÿ”‰ Be slightly more verbose

-f fromformat ๐Ÿ“ฅ Read a file in the given format from STDIN

fromformat can be one of:

-t toformat ๐Ÿ“ค Write the file in the given format to STDOUT

toformat can be one of:

-e code ๐Ÿงช Evaluate Perl 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 $_, and whatever is in there is written out afterwards.

๐ŸŽฏ EXAMPLES

cpanel_json_xs -t none <isitreally.json

โœ… JSON Lint โ€” tries to parse the file isitreally.json as JSON โ€” if it is valid JSON, the command outputs nothing, otherwise it will print an error message and exit with non-zero exit status.

<src.json cpanel_json_xs >pretty.json

โœจ Prettify the JSON file src.json to dst.json.

cpanel_json_xs -f storable-file <file

๐Ÿ“ฅ Read the serialized Storable file file and print a human-readable JSON version of it to STDOUT.

cpanel_json_xs -f storable-file -t yaml <file

๐Ÿ”„ Same as above, but write YAML instead (not using JSON at all ๐Ÿ˜Š)

cpanel_json_xs -f none -e '$_ = [1, 2, 3]'

๐Ÿงช Dump the perl array as UTF-8 encoded JSON text.

<torrentfile cpanel_json_xs -f bencode -e '$_ = join "\n", map @$_, @{$_->{"announce-list"}}' -t string

๐Ÿ”— Print the tracker list inside a torrent file.

lwp-request http://cpantesters.perl.org/show/Cpanel-JSON-XS.json | cpanel_json_xs

๐ŸŒ Fetch the cpan-testers result summary "Cpanel::JSON::XS" and pretty-print it.

cpanel_json_xs -f yaml-xs -t yaml-tiny <META.yml   >MYMETA.yml
cpanel_json_xs -f yaml-tiny -t yaml-xs <MYMETA.yml >XSMETA.yml
cpanel_json_xs -f yaml -t yaml <XSMETA.yml #BOOM!
Error: YAML_LOAD_ERR_BAD_MAP_ELEMENT

โš ๏ธ Compare YAML en- and decoders, and see that YAML::XS generates unparsable YAML <https://github.com/ingydotnet/yaml-libyaml-pm/issues/9>

๐Ÿ‘ค AUTHOR

Copyright (C) 2008 Marc Lehmann <json@schmorp.de> Copyright (C) 2016 Cpanel Inc

cpanel_json_xs(1p)
๐Ÿ“‹ NAME ๐Ÿš€ Quick Reference ๐Ÿ“– SYNOPSIS ๐Ÿ“ DESCRIPTION โš™๏ธ OPTIONS
-v ๐Ÿ”‰ Be slightly more verbose -f fromformat ๐Ÿ“ฅ Read a file in the given format from STDIN -t toformat ๐Ÿ“ค Write the file in the given format to STDOUT -e code ๐Ÿงช Evaluate Perl code
๐ŸŽฏ EXAMPLES ๐Ÿ‘ค AUTHOR

Generated by phpman v4.10.0-7-g98e9fd5 · Markdown · JSON · MCP Author: Che Dong Under GNU General Public License
2026-09-04 07:17 @216.73.216.46
CrawledBy Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)
Valid XHTML 1.0 Transitional!Valid CSS!

^_top_^