Commit Graph
5 Commits
Author SHA1 Message Date
Wleeaf d9b375ff1b json_pointer: find null array elements
json_pointer_get_single_path() returned ENOENT when the array element
at an in-range index was NULL, which is how json-c stores a JSON null.
A null object member was already found, but on [0, null, 2] "/1" failed
with "not found", although RFC 6901 says it references the null value.

The array index is bounds-checked just before, so a NULL element now
resolves like a null member: json_pointer_get() returns 0 and sets
*res to NULL. This also fixes json_patch_apply(), which failed every
"test", "replace" and "remove" on a null array element, and every
"move" and "copy" from one, with "Did not find element referenced by
path field".

Added a json_pointer_get() test, and json_patch_tests.json cases that
mirror the existing null object member ones.
2026-10-26 00:39:03 -04:00
Javid Khan dcdea4e906 decode ~1/~0 escapes when setting an object member in json_pointer 2026-08-22 12:01:01 +05:30
Javid Khan 70f3169bae reject empty reference token as array index in json_pointer 2026-07-20 14:44:51 +05:30
dota17 48ae9e8874 update pointer test case 2020-01-02 10:49:29 +08:00
Alexandru Ardelean ee7fc26de1 tests: add test_json_pointer test
Signed-off-by: Alexandru Ardelean <ardeleanalex@gmail.com>
2016-11-04 09:59:43 +02:00