Given the following Json
{
"id":"MENU_FULL_V2",
"version":"MENU_FULL_V2",
"type":"MAIN",
"icon":"shopping-bag-r",
"description":"This is the description {$.description}",
"order":15000,
"code":"code",
"filter":"{$.contractedServices[*].contractId}",
"status":"ENABLED",
"contextData":{
"docType":"{$.documentType}",
"docNumber":"{$.documentNumber}",
"organizationName":"{$.name}",
"contractedServices":"{$.contractedServices[*]}"
},
"children":[
{
"id":"MENU_CHILD_1",
"version":"MENU_FULL_V2",
"type":"CHILD",
"description":"This is the description {$.description}"
},
{
"id":"MENU_CHILD_2",
"version":"MENU_FULL_V2",
"type":"CHILD",
"description":"This is the description {$.description}"
}
]
}
How can I return a List of string which contains all the paths to the values that has { }
in their value.
Is there a way to get all the values that match this regular expresion see
So far I have this.
Configuration conf = Configuration.builder()
.options(Option.AS_PATH_LIST).build();
List<String> pathList = JsonPath.using(conf).parse(json).read("//GET ALL PATHS THAT MATCH REGEX");
The expected output for pathList
should contain all paths that have values that have { }
ie:
"$['description']",
"$['filter']",
"$['contextData']['docType']",
"$['contextData']['docNumber']"
Note that the list is not complete, but it should contain all the paths that have values with { }