title: jsonpath_rw for Python: How to navigate relatively?
body: <p>I have a configuration database stored in a json file. This file is read from disk, parsed by Pythons <em>json</em> library and stored in a variable called <code>json</code>.</p>
  
  <p>Now I'm investigating <em>jsonpath_rw</em> to build more readable path expressions then writing pure Python code to access multiple nested dicts and arrays.</p>
  
  <p>Here is my current code:</p>
  
  <pre><code># select all UART device serial numbers
  exprSerial = parse('FPGAList.[*].UART.Serial')
  
  #for serial in UART serial list
  for match in exprSerial.find(json):
    print("Match: " + match.value + "    Path:" + str(match.full_path))
  
    if (match.value == USBSerial):
      #exprUART = match.full_path.Descendants) #under construction
  </code></pre>
  
  <p>The first expression lists all UART device serial numbers. The result is displayed on screen and working. Regarding the online documentation, I can print out the full path of the matching object by accessing <code>match.full_path</code>. This is a <em>jsonpath</em> object. If I call <code>str(..)</code> on it, it's transformed into a readable string.</p>
  
  <p>Next, my code compares the value with a given serial number. If it's true, I would like to check some other parameters for safety: e.g. <code>USBDeviceVendor</code>. This key is also stored in the json file on the same hierarchy level.</p>
  
  <p>My goal is it to construct a new jsonpath relative to <code>match.full_path</code> to access <code>USBDeviceVendor</code>.</p>
  
  <p><strong>Bad solution:</strong> <code>exprVendor = parse(str(match.full_path) + "..USBDeviceVendor")</code></p>
  
  <p><strong>Is it possible to extend <code>match.full_path</code> like <code>match.full_path.relative("..USBDeviceVendor")</code>?</strong></p>