@@ -275,22 +275,26 @@ Table of Contents
275
275
o If the currently referenced value is a JSON array, the reference
276
276
token CAN be compromised of two sets of digits (according to the
277
277
ABNF syntax for array indices as specified in Section 4 of
278
- [RFC6901]), delimited by a character "-". Each set of digits
278
+ [RFC6901]), delimited by the character "-". Each set of digits
279
279
represent an unsigned base-10 integer value. The first integer
280
- value MUST be smaller than the number of elements in the array,
281
- except when it is equal to the second integer value and is equal to
282
- the number of elements in the array. The second integer value MUST
283
- be smaller than or equal to the number of elements in the array.
284
- The second integer value MUST be larger than or equal to the first
285
- integer value. If any of these requirements are violated, an error
286
- condition is raised.
280
+ value MUST be smaller than the number of elements in the array. The
281
+ second integer value MUST be smaller than or equal to the number of
282
+ elements in the array. The second integer value MUST be larger than
283
+ or equal to the first integer value. If any of these requirements
284
+ are violated, an error condition is raised.
287
285
288
286
The new referenced value is a new array with a subset of elements
289
287
starting at the zero-based index of the first integer value, and
290
288
ending at the element before the zero-based index of the second
291
289
integer value (the first index is inclusive, the second index is
292
290
exclusive).
293
291
292
+ o If the currently referenced value is a JSON array, the reference
293
+ token CAN be the character "-". The new referenced value is a
294
+ zero-length array corresponding to the position immediately after
295
+ the end of the current array. This design makes such JSON pointer
296
+ compatible with the use of JSON pointers in JSON Patch [RFC6902].
297
+
294
298
o If the currently referenced value is a JSON string, the scheme for
295
299
JSON arrays is used to index into a string and makes the new
296
300
referenced value a substring of the currently referenced value.
@@ -317,16 +321,17 @@ Table of Contents
317
321
"/foo/0-1" ["bar"]
318
322
"/foo/1-3" ["baz", "bax"]
319
323
"/foo/1-1" []
320
- "/foo/3-3" []
324
+ "/foo/-" []
325
+ "/foo/3-3" // error
321
326
"/foo/4-4" // error
322
327
"/foo/1-0" // error
323
328
"/foo/1-4" // error
324
329
"/foo/1-3/0" // error
325
330
"/foo/0/1-3" "ar"
326
331
327
- JSON ranges "/foo/1-1" and "/foo/3-3 " are on its own of little
328
- utility, but serve as a zero-length range to identify a location
329
- immediately before which new content can be inserted with a patch.
332
+ JSON ranges "/foo/1-1" and "/foo/- " are on its own of little utility,
333
+ but serve as a zero-length range to identify a location immediately
334
+ before which new content can be inserted with a patch.
330
335
331
336
3.3. Lines Range Unit
332
337
@@ -480,6 +485,9 @@ Table of Contents
480
485
[RFC6901] Bryan, P., Zyp, K., and M. Nottingham, "JavaScript Object
481
486
Notation (JSON) Pointer", RFC 6901, April 2013.
482
487
488
+ [RFC6902] Bryan, P., and M. Nottingham, "JavaScript Object Notation
489
+ (JSON) Patch", RFC 6902, April 2013.
490
+
483
491
8.2. Informative References
484
492
485
493
[RFC8259] T. Bray, "The JavaScript Object Notation (JSON) Data
0 commit comments