Skip to content

Commit fc7bdd0

Browse files
author
Raymond McCrae
committed
Update readme
1 parent 5314081 commit fc7bdd0

File tree

1 file changed

+30
-2
lines changed

1 file changed

+30
-2
lines changed

README.md

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,30 @@
1-
# swift-jsonpatch
2-
json-patch [RFC6902] implementation in Swift
1+
# JSONPatch - Swift 4 json-patch implementation
2+
JSONPatch is a a swift module implements json-patch [RFC6902](https://tools.ietf.org/html/rfc6902). JSONPatch uses [JSONSerialization](https://developer.apple.com/documentation/foundation/jsonserialization) from Foundation, and has no dependencies on third-party libraries.
3+
4+
The implementation uses the [JSON Patch Tests](https://github.com/json-patch/json-patch-tests) project for unit tests to validate its correctness.
5+
6+
The module currently only supports applying json-patches, and does not support generating a patch based on the differences between two json documents.
7+
8+
# Release
9+
0.1 - Initial Release
10+
11+
# Usage
12+
```swift
13+
import JSONPatch
14+
15+
let jsonstr = """
16+
{"foo": "bar"}
17+
"""
18+
let patchstr = """
19+
{"op": "add", "path": "/baz", "value": "qux"}
20+
"""
21+
22+
let json = Data(jsonstr.utf8)
23+
let patch = try! JSONPatch(data: Data(patchstr.utf8))
24+
let patched = try! patch.apply(to: json)
25+
```
26+
27+
28+
# License
29+
30+
Apache License v2.0

0 commit comments

Comments
 (0)