Giter Club home page Giter Club logo

aeson-diff's Introduction

Aeson Diff

Build Status Hackage Hackage-Deps

This is a small library for working with changes to JSON documents. It includes a library and two executables in the style of diff(1) and patch(1). Patches are themselves JSON Patch documents as specified in RFC 6902.

Installing

The aeson-diff package is written in Haskell and can be installed using the Cabal package management tool, stack, or something similar.

stack install aeson-diff

The command-line tools can then be executed using stack:

stack exec json-diff -- ....
stack exec json-patch -- ....

If you prefer to use Cabal, something like this might do the trick:

cd aeson-diff/
cabal sandbox init
cabal install --dependencies-only
cabal build
sudo mkdir -p /usr/local/bin
sudo cp dist/build/json-*/json-{diff,patch} /usr/local/bin/

Usage

Patch format

aeson-diff supports the JSON Patch format described in RFC 6902.

json-diff command

The json-diff command compares two JSON documents and extracts a patch describing the differences between the first document and the second.

Usage: json-diff [-T|--test-before-remove] [-o|--output OUTPUT] FROM TO
Generate a patch between two JSON documents.

Available options:
    -h,--help                Show this help text
    -T,--test-before-remove  Include a test before each remove.
    -o,--output OUTPUT       Write patch to file OUTPUT.

json-patch command

The json-patch command applies a patch describing changes to be made to a JSON document.

Usage: json-patch [-o|--output OUTPUT] PATCH FROM
Generate a patch between two JSON documents.

Available options:
  -h,--help                Show this help text
  -o,--output OUTPUT       Destination for patched JSON.
  PATCH                    Patch to apply.
  FROM                     JSON file to patch.

aeson-diff library

The aeson-diff library exports as single module: Data.Aeson.Diff. This exports diff and patch functions which do exactly what might be expected:

  • diff :: Value -> Value -> Patch examines source and target JSON Values and constructs a new Patch describing the changes.

  • patch :: Patch -> Value -> Result Value applies the changes in a Patch to a JSON Value. If an error results then an exception is thrown.

For more complete information, see the documentation.

aeson-diff's People

Contributors

bosu avatar christian-marie avatar k-bx avatar peaker avatar thsutton avatar tranma avatar vaibhavsagar avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.