cancel
Showing results for 
Search instead for 
Did you mean: 

JSON path and case insensitive search

Don
New Contributor

I'm having issues trying to find all instances that match a particular email address using JSONPath.  The example below is just an array of email objects, but the real data is an array or personnell profiles that I need to search by an email address that has random capitalization in it. 

Example data:

 

{    "data": [
      {"email": "yomomma@notreal.com" },
      { "email": "yoyoma@notreal.com"  },
      { "email": "yoyomama@notreal.com" },
      {"email": "someOtherEmail@notreal.com" },
      { "email": "YoMomma@notreal.com"  },
      { "email": "General@frustration.com" },
      { "email": "ILike@cookies.com" }     ]  }

 

I can get a single value out by using:

 

jsonPath($data, "$[?(@.email == 'yomomma@notreal.com')]")

 

Extending that using the regex syntax used elsewhere made me think that this should find all instances:

 

jsonPath($data, "$[?(@.email =~/yomomma@notreal.com/i )]")

 

No luck.
An alternate format (Goessner I believe) didn't work either:

 

jsonPath($data, "$[?(/yomomma@notreal.com/i.test(@.email))]")

 

 

Any help would be greatly appreciated.

1 REPLY 1

SpiroTaleski
Valued Contributor

@Don 

Find the attached sample pipeline. It uses array filter function for filtering the elements. 

Hope it will helps.