Skip to content

Commit d4cadc0

Browse files
authored
Update README.md
A couple more @ examples
1 parent f72f379 commit d4cadc0

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

README.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ JSONPath Expression | Description
2424
`..*` or `..[*]`| Wildcard operator with recursive descent explodes the contents of your JSON quite well
2525
`()`| A script expression uses the returned value of the expression to as the property name or index
2626
`?()`| A filter expression interrogates all array/object members against the expression, descending into or returning the value of those that match
27-
`@` | Use inside a filter or script expression. `@` is substituted with the value of the current object, `@name` will match the current property name, `@.length` will reference the length of an array or string, `@.key` will reference the property "key" of the current object
27+
`@` | Use inside a filter or script expression. `@` is substituted with the value of the current object, `@name` will match the current property name, `@.length` will reference the length of an array or string, `@.key`, `@["key"]`, or `@['key']` would reference the property named "key" of the current object, `@[1]` would be used for an array
2828
`[]`| Subscript/child operator; can contain quoted property names (`'key'`,`"key"`), numbers (negative or positive), filter and script expressions, `*` and `-` operators
2929
`[start:end:step]`| Array/string slice operator like Python's, all field are optional, start and end default to bounds, step can be negative
3030
`[,]`| Union operator `,` allows multiple quoted key names, array indices, slices, script/filter expressions, and `*` to be combined
@@ -221,9 +221,7 @@ expr = expr.split('/')
221221
expr.shift()
222222
//replace special symbols ~1 and ~0 (in this order) with the actual characters
223223
//convert string representations of numbers to Number types (for proper quoting in PATH output)
224-
expr = expr.map(function (f){
225-
return f.replace(/~1/g,"/").replace(/~0/g,"~") })
226-
.map(function(a){ return a === "" ? "" : isNaN(a) ? a : Number(a)})
224+
expr = expr.map(function (f){ return f.replace(/~1/g,"/").replace(/~0/g,"~") })
227225
```
228226

229227
JSON Pointer example:

0 commit comments

Comments
 (0)