Example #1
0
 def test_find_all(self):
   doc = dict(
     person=dict(
       name="Trey",
       things=[
         dict(id=1, name="One"),
         dict(id=2, name="Two")
       ]))
   self.assertEqual(set(jp.find_all(doc, "/person/things/*/name")), {"One", "Two"})
Example #2
0
def get_json_vals(source, path):
  """Get all the nested values identified by the json path, rooted at source."""
  yield from JP.find_all(source, path)