The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

jpath - Command-line tool for JSON::Path

VERSION

This document describes version 0.050 of jpath (from Perl distribution App-jpath), released on 2023-02-14.

SYNOPSIS

Usage:

 % jpath [OPTIONS] <JSONPATH_EXPR> < data.json

DESCRIPTION

This script provides a simple, relatively straightforward command-line interface for JSON::Path. It accepts JSON input as well as several other formats; and similarly can output JSON or alternative formats.

This script sets $JSON::Path::Safe to 0 so you can eval Perl expressions.

EXIT CODES

0 on success.

99 on command-line options error.

OPTIONS

  • --input=STR, -i

    Pick input format. Available formats: json, yaml (using YAML::Syck), perl. Default is json.

  • --output=STR, -o

    Pick output format. Available formats: json, yaml, perl, and pretty (using Data::Format::Pretty::Console). Default is json.

FAQ

How do I turn off colors and line numbers?

Use COLOR=0 and LINUM=0, respectively. For example:

 % LINUM=0 jpath ...

See Data::Format::Pretty::JSON and other Data::Format::Pretty::* for more details.

HOMEPAGE

Please visit the project's homepage at https://metacpan.org/release/App-jpath.

SOURCE

Source repository is at https://github.com/perlancar/perl-App-jpath.

SEE ALSO

JSON::Path.

App::dpath, a similar command-line tool, for Data::DPath.

Someone should perhaps also write tpath for TPath (TPath::Forester::Ref).

jsonpath, jcut (from App::PipeFilter). A command-line tool that works on a per-record basis.

App::jt, a command-line tool that deals specifically with JSON input and in addition to doing JSONPath also provides some extra tools like simple filtering capability for simple structures (e.g. arrays, array of hashes), convert to CSV, etc.

App::SerializeUtils, various command-line scripts to convert or check data structure in various formats.

jsonsel (from App::jsonsel) uses CSS-like selector syntax to select nodes from JSON.

jq, https://stedolan.github.io/jq/

AUTHOR

perlancar <perlancar@cpan.org>

CONTRIBUTING

To contribute, you can send patches by email/via RT, or send pull requests on GitHub.

Most of the time, you don't need to build the distribution yourself. You can simply modify the code, then test via:

 % prove -l

If you want to build the distribution (e.g. to try to install it locally on your system), you can install Dist::Zilla, Dist::Zilla::PluginBundle::Author::PERLANCAR, Pod::Weaver::PluginBundle::Author::PERLANCAR, and sometimes one or two other Dist::Zilla- and/or Pod::Weaver plugins. Any additional steps required beyond that are considered a bug and can be reported to me.

COPYRIGHT AND LICENSE

This software is copyright (c) 2023, 2016, 2014 by perlancar <perlancar@cpan.org>.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.

BUGS

Please report any bugs or feature requests on the bugtracker website https://rt.cpan.org/Public/Dist/Display.html?Name=App-jpath

When submitting a bug or request, please include a test-file or a patch to an existing test-file that illustrates the bug or desired feature.