title: How can I find the row & column in a JSON String identified by a JsonPath?
body: <p>Suppose I have a JSON string like this example:</p>
  
  <pre><code>[
    {
      "name": "John"
    },
    {
      "name": "Jane"
    }
  ]
  </code></pre>
  
  <p>Using JSONPath I want to select the second name like this:</p>
  
  <pre><code>[1].name
  </code></pre>
  
  <p>However, I am not interested in the name's value but rather in the row &amp; column of the entire second name key-value pair as they appear in the String. In this example, the expected result when written as a JSON would be:</p>
  
  <pre><code>{
    "row": 5,
    "column": 4
  }
  </code></pre>
  
  <p>Alternatively, the index within the String would be fine as well. Note that I don't require the result to be a JSON. Note also that this should work with any formatting of the JSON.</p>
  
  <p>I have thought about constructing a regular expression but this might be fragile if the key's name <em>"name"</em> also appears as text in values.</p>
  
  <p>I am using Jayway JSONPath in my Java backend but a solution with a different JSONPath library, or one in JavaScript using an Node.js compatible library would also be fine.</p>