GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - apack1001/json-diff-patch: a python clone of benjamine/jsondiffpatch

BranchesTags
Open more actions menu

Latest commit

 

History

6 Commits
6 Commits

Folders and files

NameName
Last commit message
Last commit date
lib
lib
 
 
README.md
README.md
 
 
setup.cfg
setup.cfg
 
 
setup.py
setup.py
 
 

Repository files navigation

JSON tools

Manipulate JSON documents using "JSON patch" format.

This software is available under the MIT License

This software gains inspration from json_tools and benjamin/jsondiffpatch

Installation

$ pip install git+https://github.com/apack1001/json-diff-patch.git

Release notes

TBD

Running tests

Just run nosetests from the repo root.

Usage

There are two ways of using json_diff_patch:

  1. As a CLI utilty.
  2. As a Python module.

CLI interface

After you've installed json_diff_patch you can access it via json command in the shell. It provides a pretty simple yet powerful interface to manipulate JSON documents:

  • print [input_file]

    Pretty-print a JSON file with syntax highlighting and keys sorting.

    If input_file is omitted or equals -, reads JSON from STDIN.

    Example:

    $ echo '{"Hello": ["w", "o", "r", "l", "d", "!"]}' | json print
    {
        "Hello": [
            "w",
            "o",
            "r",
            "l",
            "d",
            "!"
        ]
    }
    
  • diff [file1] [file2]

    Calculate difference between two JSON documents and output it in JSON patch format.

    Either file1 or file2 can be set to -, in order to read JSON from STDIN.

    Example:

    $ json diff doc1.json doc2.json
    [
        {
            "add": "/lol",
            "value": "wut"
        },
        {
            "remove": "/some/field",
            "prev": {
                "compound": "value"
            }
        }
    ]
    
  • patch [options] input [patch [patch ...]]

    Modify the JSON file input using a series of JSON patches.

    If patch is omitted or equals -, its content is read from STDIN.

    Options:

    -i, --inplace

    Modify source_file inplace instead of printing it to STDOUT.

Pythonic interface

TBD

Planned features

  1. Support more JSON patch options: currently json_diff_patch only supports add, remove and replace.
  2. Make diff output more human readable (not JSONish).
  3. Improve documentation.

About

a python clone of benjamine/jsondiffpatch

Resources

Readme
Activity

Stars

6 stars

Watchers

1 watching

Forks

2 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.