Ejemplo n.º 1
0
def get_json_val(source, path, *, ignore_bad_path=False):
  """Get the nested value identified by the json path, rooted at source."""
  try:
    return JP.find(source, path)
  except JP.JSONPathError as ex:
    if ignore_bad_path:
      return None
    else:
      raise
Ejemplo n.º 2
0
 def test_find(self):
   self.assertEqual(jp.find(self.document, "/spouse/name"), "Julie")
   self.assertEqual(jp.find(self.document, "/spouse/computers/1"), "iPhone 6")