Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/elitemastereric/jsonpatch
https://github.com/elitemastereric/jsonpatch
Last synced: about 1 month ago
JSON representation
- Host: GitHub
- URL: https://github.com/elitemastereric/jsonpatch
- Owner: EliteMasterEric
- License: mit
- Created: 2024-07-26T02:44:17.000Z (6 months ago)
- Default Branch: master
- Last Pushed: 2024-07-26T02:45:24.000Z (6 months ago)
- Last Synced: 2024-07-26T03:57:19.679Z (6 months ago)
- Language: Haxe
- Size: 146 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE.md
Awesome Lists containing this project
README
# JSONPatch
A library for parsing and evaluating [JSONPatch](https://jsonpatch.com/) files on JSON data objects.
It deviates from the spec in that it supports both [JSONPointer](https://datatracker.ietf.org/doc/rfc6901/) and [JSONPath](https://datatracker.ietf.org/doc/rfc9535/) for the path argument.
The implementation seeks to otherwise be compliant with [RFC6902](https://datatracker.ietf.org/doc/rfc6902/).
## Example
```haxe
import json.patch.JSONPatch;var patch = [
{"op": "add", "path": "/a/d", "value": "e"}
];
var data = {"a": {"b": "c"}}// {"a": {"b": "c", "d": "e"}}
trace(JSONPatch.applyPatch(patch, data));// JSONPath is also supported.
var patch = [
{"op": "replace", "path": "$..c", "value": 3}
];
var data = {"a": {"c": 11}, "b": {"c": 12}};// {"a": {"c": 3 }, "b": { "c": 3 }}}
trace(JSONPatch.applyPatch(patch, data));
```## Licensing
JSONPatch is made available under an open source MIT License. You can read more at [LICENSE](LICENSE.md).