diff --git a/README.rst b/README.rst index 9ffa19e..edd7efc 100644 --- a/README.rst +++ b/README.rst @@ -213,6 +213,10 @@ To use the extensions below you must import from `jsonpath_ng.ext`. +==============+===============================================+ | len | - ``$.objects.`len``` | +--------------+-----------------------------------------------+ +| keys | - ``$.objects.`keys``` | ++--------------+-----------------------------------------------+ +| str | - ``$.field.`str()``` | ++--------------+-----------------------------------------------+ | sub | - ``$.field.`sub(/foo\\\\+(.*)/, \\\\1)``` | | | - ``$.field.`sub(/regex/, replacement)``` | +--------------+-----------------------------------------------+ diff --git a/tests/test_examples.py b/tests/test_examples.py index ca2ec17..c07732a 100644 --- a/tests/test_examples.py +++ b/tests/test_examples.py @@ -37,9 +37,15 @@ ("$..book[-1:]", Child(Descendants(Root(), Fields("book")), Slice(start=-1))), # # The first two books - # "$..book[0,1]" # Not implemented + ("$..book[0,1]", Child(Descendants(Root(), Fields("book")), Index(0,1))), ("$..book[:2]", Child(Descendants(Root(), Fields("book")), Slice(end=2))), # + # Categories and authors of all books + ( + "$..book[0][category,author]", + Child(Child(Descendants(Root(), Fields('book')), Index(0)), Fields('category','author')), + ), + # # Filter all books with an ISBN ( "$..book[?(@.isbn)]",