You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- Docs (README): Indicate features, including performance (removing old note)
- Docs (README): Add headings for setup and fix headings levels
- Docs (README): Indicate parent selector was not present in original spec (not just not documented)
- Docs (README): Fix escaping
@@ -141,7 +177,7 @@ evaluate method (as the first argument) include:
141
177
accept any of the other allowed instance properties (except
142
178
for `autostart` which would have no relevance here).
143
179
144
-
## Class properties and methods
180
+
###Class properties and methods
145
181
146
182
-***JSONPath.cache*** - Exposes the cache object for those who wish
147
183
to preserve and reuse it for optimization purposes.
@@ -160,7 +196,7 @@ evaluate method (as the first argument) include:
160
196
Pointer spec). The JSONPath terminal constructions `~` and `^` and
161
197
type operators like `@string()` are silently stripped.
162
198
163
-
# Syntax through examples
199
+
##Syntax through examples
164
200
165
201
Given the following JSON, taken from <http://goessner.net/articles/JsonPath/>:
166
202
@@ -260,7 +296,7 @@ comparisons or to prevent ambiguity).
260
296
/ | $ | The root of the JSON object (i.e., the whole object itself) | To get a literal `$` (by itself or anywhere in the path), you must use the backtick escape
261
297
//\*/\*\|//\*/\*/text() | $..* | All Elements (and text) beneath root in an XML document. All members of a JSON structure beneath the root. |
262
298
//* | $.. | All Elements in an XML document. All parent components of a JSON structure including root. | This behavior was not directly specified in the original spec
263
-
//*\[price>19]/.. | $..\[?(@.price>19)]^ | Parent of those specific items with a price greater than 19 (i.e., the store value as the parent of the bicycle and the book array as parent of an individual book) | Parent (caret) not documented in the original spec
299
+
//*\[price>19]/.. | $..\[?(@.price>19)]^ | Parent of those specific items with a price greater than 19 (i.e., the store value as the parent of the bicycle and the book array as parent of an individual book) | Parent (caret) not present in the original spec
264
300
/store/*/name() (in XPath 2.0) | $.store.*~ | The property names of the store sub-object ("book" and "bicycle"). Useful with wildcard properties. | Property name (tilde) is not present in the original spec
265
301
/store/book\[not(. is /store/book\[1\])\] (in XPath 2.0) | $.store.book\[?(@path !== "$\[\'store\']\[\'book\']\[0]")] | All books besides that at the path pointing to the first | @path not present in the original spec
266
302
//book\[parent::\*/bicycle/color = "red"]/category | $..book\[?(@parent.bicycle && @parent.bicycle.color === "red")].category | Grabs all categories of books where the parent object of the book has a bicycle child whose color is red (i.e., all the books) | @parent is not present in the original spec
@@ -269,13 +305,13 @@ comparisons or to prevent ambiguity).
269
305
/store/\*/\*\[name(parent::*) != 'book'] | $.store.*\[?(@parentProperty !== "book")] | Grabs the grandchildren of store whose parent property is not book (i.e., bicycle's children, "color" and "price") | @parentProperty is not present in the original spec
270
306
//book\[count(preceding-sibling::\*) != 0]/\*/text() | $..book.*\[?(@parentProperty !== 0)] | Get the property values of all book instances whereby the parent property of these values (i.e., the array index holding the book item parent object) is not 0 | @parentProperty is not present in the original spec
271
307
//book/../\*\[. instance of element(\*, xs:decimal)\] (in XPath 2.0) | $..book..\*@number() | Get the numeric values within the book array | @number(), the other basic types (@boolean(), @string()), other low-level derived types (@null(), @object(), @array()), the JSONSchema-added type, @integer(), the compound type @scalar() (which also accepts `undefined` and non-finite numbers for JavaScript objects as well as all of the basic non-object/non-function types), the type, @other(), to be used in conjunction with a user-defined callback (see `otherTypeCallback`) and the following non-JSON types that can nevertheless be used with JSONPath when querying non-JSON JavaScript objects (@undefined(), @function(), @nonFinite()) are not present in the original spec
272
-
| | `` ` `` (e.g., `` `$`` to match a property literally named `$`) | Escapes the entire sequence following (to be treated as a literal) | `\`` is not present in the original spec; to get a literal backtick, use an additional backtick to escape
308
+
| | `` ` `` (e.g., `` `$`` to match a property literally named `$`) | Escapes the entire sequence following (to be treated as a literal) | `` ` `` is not present in the original spec; to get a literal backtick, use an additional backtick to escape
273
309
274
310
Any additional variables supplied as properties on the optional "sandbox"
275
311
object option are also available to (parenthetical-based)
276
312
evaluations.
277
313
278
-
# Potential sources of confusion for XPath users
314
+
##Potential sources of confusion for XPath users
279
315
280
316
1. In JSONPath, a filter expression, in addition to its `@` being a
281
317
reference to its children, actually selects the immediate children
@@ -286,14 +322,14 @@ from 0), whereas in XPath, they are 1-based.
286
322
1. In JSONPath, equality tests utilize (as per JavaScript) multiple equal signs
287
323
whereas in XPath, they use a single equal sign.
288
324
289
-
# Ideas
325
+
##Ideas
290
326
291
327
1. Support OR outside of filters (as in XPath `|`) and grouping.
292
328
1. Create syntax to work like XPath filters in not selecting children?
293
329
1. Allow option for parentNode equivalent (maintaining entire chain of
0 commit comments