1JSON_XS(1) User Contributed Perl Documentation JSON_XS(1)
2
3
4
6 json_xs - JSON::XS commandline utility
7
9 json_xs [-v] [-f inputformat] [-t outputformat]
10
12 json_xs converts between some input and output formats (one of them is
13 JSON).
14
15 The default input format is "json" and the default output format is
16 "json-pretty".
17
19 -v Be slightly more verbose.
20
21 -f fromformat
22 Read a file in the given format from STDIN.
23
24 "fromformat" can be one of:
25
26 json - a json text encoded, either utf-8, utf16-be/le, utf32-be/le
27 storable - a Storable frozen value
28 storable-file - a Storable file (Storable has two incompatible
29 formats)
30 clzf - Compress::LZF format (requires that module to be installed)
31 yaml - YAML (avoid at all costs, requires the YAML module :)
32 -t toformat
33 Write the file in the given format to STDOUT.
34
35 "fromformat" can be one of:
36
37 json, json-utf-8 - json, utf-8 encoded
38 json-pretty - as above, but pretty-printed
39 json-utf-16le, json-utf-16be - little endian/big endian utf-16
40 json-utf-32le, json-utf-32be - little endian/big endian utf-32
41 storable - a Storable frozen value in network format
42 storable-file - a Storable file in network format (Storable has two
43 incompatible formats)
44 clzf - Compress::LZF format
45 yaml - YAML
46
48 json_xs -t null <isitreally.json
49
50 "JSON Lint" - tries to parse the file isitreally.json as JSON - if it
51 is valid JSON, the command outputs nothing, otherwise it will print an
52 error message and exit with non-zero exit status.
53
54 <src.json json_xs >pretty.json
55
56 Prettify the JSON file src.json to dst.json.
57
58 json_xs -f storable-file <file
59
60 Read the serialised Storable file file and print a human-readable JSON
61 version of it to STDOUT.
62
63 json_xs -f storable-file -t yaml <file
64
65 Same as above, but write YAML instead (not using JSON at all :)
66
67 lwp-request http://cpantesters.perl.org/show/JSON-XS.json | json_xs
68
69 Fetch the cpan-testers result summary "JSON::XS" and pretty-print it.
70
72 Copyright (C) 2008 Marc Lehmann <json@schmorp.de>
73
74
75
76perl v5.12.0 2008-07-27 JSON_XS(1)