Skip to content

Commit 411cf20

Browse files
committed
add to_json to readme
1 parent 7c09f8d commit 411cf20

File tree

3 files changed

+21
-3
lines changed

3 files changed

+21
-3
lines changed

README.md

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
## Quick-start
1111

1212
```python
13-
from patchdiff import apply, diff, iapply
13+
from patchdiff import apply, diff, iapply, to_json
1414

1515
input = {"a": [5, 7, 9, {"a", "b", "c"}], "b": 6}
1616
output = {"a": [5, 2, 9, {"b", "c"}], "b": 6, "c": 7}
@@ -22,4 +22,22 @@ assert apply(output, reverse_ops) == input
2222

2323
iapply(input, ops) # apply in-place
2424
assert input == output
25+
26+
print(to_json(ops, indent=4))
27+
# [
28+
# {
29+
# "op": "add",
30+
# "path": "/c",
31+
# "value": 7
32+
# },
33+
# {
34+
# "op": "replace",
35+
# "path": "/a/1",
36+
# "value": 2
37+
# },
38+
# {
39+
# "op": "remove",
40+
# "path": "/a/3/a"
41+
# }
42+
# ]
2543
```

patchdiff/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
from .diff import diff
33
from .serialize import to_json
44

5-
__version__ = "0.2.0"
5+
__version__ = "0.3.0"

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "patchdiff"
3-
version = "0.2.0"
3+
version = "0.3.0"
44
description = "MIT"
55
authors = ["Korijn van Golen <[email protected]>"]
66
homepage = "https://github.com/Korijn/patchdiff"

0 commit comments

Comments
 (0)