Skip to content

Commit 19c9c2f

Browse files
str is a Sequence in Python but it's not to be treated like a JSON array
1 parent 5998f95 commit 19c9c2f

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

jsonpointer.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,9 @@ def get_part(cls, doc, part):
223223
if isinstance(doc, Mapping):
224224
return part
225225

226+
elif isinstance(doc, str):
227+
raise JsonPointerException("Cannot apply token '%s' to non-container type %s" % (part, type(doc)))
228+
226229
elif isinstance(doc, Sequence):
227230

228231
if part == '-':

0 commit comments

Comments
 (0)