Extract Multiple Json Proprties From Specific Object in Response Array

I would like to extract multiple properties from a specific object in a response array. I am using jmesPath and saveAs within a check.

Example Data:

{
"fruits":[
  {
   "type": "pineapple",
   "size": "medium",
   "price": 6
  },
  {
   "type": "watermelon",
   "size": "large",
   "price": 10
  },
  {
   "type": "apple",
   "size": "small",
   "price": 2
  },
  {
   "type": "pear",
   "size": "small",
   "price": 2
  },
 ]
}

Using JmesPath I can select the apple object out of this list. I want to be able to save the size, and price, properties for later use.

I know I can use multiple jmesPath and save the data in the form

.check(
   jmesPath("pathToAppleProperty").find().saveAs("propertyName")
)

Within this example I can see the simplicity of that. However, with my real work data, It would be very convenient to save the object I find, and then pull out the properties I need.

.check(
   jmesPath("pathToApple").find().saveAs("fruitObject")
)

.exec(session -> {
   String size = session.getString(fruitObject)["size"]
   int price = session.getString(fruitObject)["price"]
})

What is the best way to pull out specific properties from a specific object in a response array?

Use ofList() to get a List of JSON objects (Maps), see Gatling - Checks

EDIT - A better solution than the code below is to utilize Gatling EL language. As pointed out below.

For others, if you extract a specific Object in a Json List, for example:

.check(
   jmesPath("fruits[?contains(type, 'apple')]|[0]")
     .ofMap()
     .find()
     .saveAs("fruit")
)

Then you can access properties of that object by doing the following:

.exec(session -> {
     Map<String, Object> myFruit =  session.getMap("fruit");
     session.set("fruitType", myFruit .get("type"));
     session.set("fruitSize", myFruit .get("size"));
     session.set("fruitPrice", myFruit .get("price"));
     return session;
})

Why do you need to do that?
With Gatling EL, you can use access by key and do #{fruit.type}, etc.

Because I was unaware that Gatling EL supported that kind of access.