title: How to convert a string to JSONPath
body: <p>I have a JSON object that has a few nested levels in it.</p>
  
  <p>I am given a string that refers to the location of a specific object.</p>
  
  <p>For instance, if my JSON object looked like:</p>
  
  <pre><code>countries: [
       canada: {
            capital: "ottawa",
            territories: [
                 yukon: {
                      capital: "yellowknife",
                      ...
                 }
                 ...
            ]
            ...
       }
  </code></pre>
  
  <p>and I'm given the string </p>
  
  <pre><code>"countries.canada.territories.yukon"
  </code></pre>
  
  <p>I want to get the object for Yukon.</p>
  
  <p>How can I do this?</p>