> const ptr = require('json-ptr')
undefined
> badPointer = new JsonPointer("/I'm/bad")
JsonPointer { path: [ 'I\'m', 'bad' ] }
> badPointer.get({}) // expecting this to return undefined
Thrown:
SyntaxError: Unexpected identifier
> badPointer = new JsonPointer(["I'm", "also", "bad"])
JsonPointer { path: [ 'I\'m', 'also', 'bad' ] }
> badPointer.get({}) // expecting this to return undefined
Thrown:
SyntaxError: Unexpected identifier
Looks like RFC 6901 mentions that quotes must be escaped in paths, but I couldn't find anything in the json-ptr docs that mentioned what is or isn't escaped by the library. Worth mentioning that it seems to work with other tricky inputs - for example, forward slashes in paths seem to be handled correctly.
Short repro via REPL using json-ptr 2.0.0:
Looks like RFC 6901 mentions that quotes must be escaped in paths, but I couldn't find anything in the
json-ptr
docs that mentioned what is or isn't escaped by the library. Worth mentioning that it seems to work with other tricky inputs - for example, forward slashes in paths seem to be handled correctly.