I'm new to JsonPath and am using the Java port https://github.com/json-path/JsonPath.
I have a JSON object that looks like this (there are actually many entries, but I have removed the additional entries for brevity).
{
"entry": [{
"fullUrl": "urn:uuid:42627ef0-ea02-4323-8059-c8dfb6125314",
"resource": {
"resourceType": "Patient",
"id": "42627ef0-ea02-4323-8059-c8dfb6125314",
"meta": {
"profile": [
"http://hl7.org/fhir/us/mcode/StructureDefinition/mcode-cancer-patient",
"http://hl7.org/fhir/us/core/StructureDefinition/us-core-patient"
]
},
"text": {
"status": "generated",
"div": "<div xmlns=\"http://www.w3.org/1999/xhtml\">Generated by <a href=\"https://github.com/synthetichealth/synthea\">Synthea</a>.Version identifier: v2.5.0-340-gabc9fc4a\n . Person seed: -7528621318134299240 Population seed: 1586172373839</div>"
}
}
}]
}
I am trying to find an entry that contains a specific URI within the profile array. I cannot seem to get the correct syntax for this to work properly and am a bit stumped at this point.
Here is what I have tried so far, without success.
$..entry[?(@.resource.meta[?(@.profile.indexOf('http://hl7.org/fhir/us/core/StructureDefinition/us-core-patient') > -1)])]
Any pointers are greatly appreciated!
Jayway Jsonpath implementation doesn't support indexOf
. use in
instead.
$..entry[?('http://hl7.org/fhir/us/core/StructureDefinition/us-core-patient' in @.resource.meta.profile)]
Please refer Filter Operators supported by Jayway jsonpath
Online Test Tool : https://jsonpath.herokuapp.com/