0

I am using jsonpath.com to try to use an email address as the KEY.

so my data might look like this:

"phoneNumbers": [
    {
      "type"  : "iPhone",
      "bob@gmail.com": 123456,
      "number": "0123-4567-8888"
    },

however, i am unable to reference the email address:

$.phoneNumbers[0]['type']             // iPhone
$.phoneNumbers[0]['number']           // 0123-4567-8888
$.phoneNumbers[0]['bob@gmail.com']    // no match
$.phoneNumbers[0]['bob\@gmail.com']   // no match
$.phoneNumbers[0]['bob\@gmail\.com']  // no match

how may i specify a jsonPath key using an email address?

edwardsmarkf
  • 1,387
  • 2
  • 16
  • 31

1 Answers1

1

The dot in .com is the problem. See this SO answer. It would seem that it should be possible to do $.phoneNumbers[0]['bob@gmail.com'], but not on jsonpath.com

The key statement in that answer:

jsonpath.com is based on an outdated version of JSONPath and is not reliable for previewing what current libraries would provide you with.

Community
  • 1
  • 1
Matt
  • 828
  • 8
  • 25
  • thank you very much - it would appear the npm version works fine. this makes me wonder if the jsonpath.com site will ever use a more current version? – edwardsmarkf Jan 03 '17 at 22:31