json-merge-patch
Version, currently 0.1.12 versions
- 0.1.1latestJun 11, 2022
- 0.1.0not indexedJun 15, 2022
github.com/caspiano/json-merge-patch
Implementation of JSON Merge Patch RFC7396
1 stars
2 dependents
License: MIT
Installation
# Add this to your shard.yml
dependencies:
json-merge-patch:
github: caspiano/json-merge-patch
version: ~> 0.1.1Then run:
shards installshard.yml
- Crystal
>= 1.0.0- License
- MIT
- Author
- Caspian Baska
Dependencies
This version declares no dependencies.
README
JSON Merge Patch
Implementation of JSON Merge Patch RFC7396
Installation
- Add the dependency to your
shard.yml:
dependencies:
json-merge-patch:
github: caspiano/json-merge-patch
- Run
shards install
Usage
Via Module
require "json-merge-patch"
a = JSON.parse %({"hi": 1, "bye": 1})
b = JSON.parse %({"hi": 2, "bye": 2})
# use the module scope
puts JSON::Any::MergePatch.merge(a, b).to_json # => {"hi": 2, "bye": 2}
puts JSON::Any::MergePatch.merge(b, a).to_json # => {"hi": 1, "bye": 1}
# or...
puts JSON::RFC7396.merge(a, b).to_json # => {"hi": 2, "bye": 2}
puts JSON::RFC7396.merge(b, a).to_json # => {"hi": 1, "bye": 1}
Via require "json-merge-patch/ext"
require "json-merge-patch/ext"
a = JSON.parse %({"hi": 1, "bye": 1})
b = JSON.parse %({"hi": 2, "bye": 2})
# The module methods are included in addition to instance methods on `JSON::Any`
puts a.merge(b) # => {"hi": 2, "bye": 2}
puts b.merge(a) # => {"hi": 1, "bye": 1}
Contributing
- Fork it
- Create your feature branch (
git checkout -b my-new-feature) - Commit your changes (
git commit -am 'Add some feature') - Push to the branch (
git push origin my-new-feature) - Create a new Pull Request
Contributors
- Caspian Baska - creator and maintainer
Documentation
Built from the current release. The first visit to a release nobody has asked for starts its build.
Links
This release
- Version
0.1.1- Tagged
- Jun 11, 2022
- Commit
9a0b8e87477f- Crystal
>= 1.0.0- Indexed
- yes
Dependents
Repository
github.com/caspiano/json-merge-patch
Metadata
- Created
- Aug 12, 2026
- Updated
- Sep 29, 2026
- Synced
- Sep 29, 2026
- Versions
- 2