File: commandline.rst

package info (click to toggle)
python-json-pointer 2.4-3
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 212 kB
  • sloc: python: 598; makefile: 163; sh: 19
file content (42 lines) | stat: -rw-r--r-- 1,050 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
The ``jsonpointer`` commandline utility
=======================================

The JSON pointer package also installs a ``jsonpointer`` commandline utility
that can be used to resolve a JSON pointers on JSON files.

The program has the following usage ::

    usage: jsonpointer [-h] [--indent INDENT] [-v] POINTER FILE [FILE ...]

    Resolve a JSON pointer on JSON files

    positional arguments:
      POINTER          File containing a JSON pointer expression
      FILE             Files for which the pointer should be resolved

    optional arguments:
      -h, --help       show this help message and exit
      --indent INDENT  Indent output by n spaces
      -v, --version    show program's version number and exit


Example
^^^^^^^

.. code-block:: bash

    # inspect JSON files
    $ cat a.json
    { "a": [1, 2, 3] }

    $ cat b.json
    { "a": {"b": [1, 3, 4]}, "b": 1 }

    # inspect JSON pointer
    $ cat ptr.json
    "/a"

    # resolve JSON pointer
    $ jsonpointer ptr.json a.json b.json
    [1, 2, 3]
    {"b": [1, 3, 4]}