|
1 | 1 | # jsonpointer - an [RFC 6901](https://datatracker.ietf.org/doc/html/rfc6901) implementation for Go |
2 | 2 |
|
| 3 | +[](https://pkg.go.dev/github.com/chanced/jsonpointer) |
| 4 | + |
3 | 5 | Package jsonpointer provides the ability to resolve, assign, and delete values |
4 | 6 | of any type, including raw JSON, by [JSON |
5 | 7 | Pointers](https://datatracker.ietf.org/doc/html/rfc6901). |
6 | 8 |
|
7 | | -[](https://pkg.go.dev/github.com/chanced/jsonpointer) |
8 | | - |
9 | | -## Motivation |
10 | | - |
11 | | -jsonpointer was built to support |
12 | | -[github.com/chanced/openapi](https://github.com/chanced/openapi) but it may be |
13 | | -useful for others so it has been released as an independent package. |
14 | | - |
15 | | -For the openapi package, I needed a way to resolve and assign JSON Pointers |
16 | | -against concrete types while also maintaining integrity of pointer values. All |
17 | | -existing JSON Pointer implementations for Go operate on `map[string]interface{}` |
18 | | -and `[]interface{}`, raw JSON, or both. |
19 | 9 |
|
20 | 10 | ## Install |
21 | 11 |
|
@@ -110,7 +100,7 @@ Package jsonpointer provides 3 interfaces: `Assigner`, `Resolver`, and |
110 | 100 | called. `ResolveJSONPointer` should not have side effects. If resolving for an assignment, utilize the |
111 | 101 | pointer to infer which type should be assigned. |
112 | 102 |
|
113 | | -Both `AssignByJSONPointer` and `DeleteByJSONPointer` are invoked on the way back from the leaf. |
| 103 | +`AssignByJSONPointer` is invoked on the way back from the leaf. `DeleteByJSONPointer` is invoked after resolving the current token. |
114 | 104 |
|
115 | 105 | All three methods are passed a pointer to the `jsonpointer.JSONPointer` so that |
116 | 106 | it can be modified. If you do not modify it, jsonpointer will assume the current |
@@ -168,7 +158,7 @@ This package is reflect heavy. While it employs the same caching mechanics as |
168 | 158 | `encoding/json` to help alleviate some of the lookup costs, there will always be |
169 | 159 | a performance hit with reflection. |
170 | 160 |
|
171 | | -There are also probably plenty of ways to improve performance of the package. |
| 161 | +There are probably plenty of ways to improve performance of the package. |
172 | 162 | Improvements or criticisms are always welcome. |
173 | 163 |
|
174 | 164 | With regards to raw JSON, `json.Marshal` and `json.Unmarshal` are utilized. |
|
0 commit comments