This is the example JSON
{
"customerId": 0,
"authorizedCustomerIds": [
0
],
"creativeVersionId": 0,
"description": "string",
"version": "string",
"duration": 0,
"frameRate": 0,
"previewImage": "string",
"previewVideo": "string",
"renderScript": "string",
"renderScriptType": "string",
"elements": [
{
"id": 0,
"type": "IMAGE",
"name": "string1",
"parentId": 0,
"presetId": 0,
"properties": [
{
"name": "string",
"value": {},
"type": "ALPHABETIC",
"producesVideo": true,
"renderScriptId": "string"
}
]
},
{
"id": 1,
"type": "TEXT",
"name": "string2",
"parentId": 0,
"presetId": 0,
"properties": [
{
"name": "string",
"value": {},
"type": "ALPHABETIC",
"producesVideo": false,
"renderScriptId": "string"
}
]
}
],
"globalElements": [
{
"id": 0,
"disabled": true
}
],
"shots": [
{
"name": "string",
"displayOrder": 0,
"startFrame": 0,
"duration": 0,
"thumbnailFrame": 0,
"elements": [
{
"id": 0,
"disabled": true
}
]
}
],
"sizes": [
{
"name": "string",
"displayOrder": 0,
"main": true,
"width": 0,
"height": 0,
"properties": [
{
"templateElementId": 0,
"propertyName": "string",
"linked": true,
"value": {}
}
]
}
]
}
I need to get the element name which type is TEXT and the properties "producesVideo" is false.
I tried this way but it not works
$..elements[?(@.type == 'TEXT' && @.properties[?(@.producesVideo == false)])].name
Then I need to extract the path with rest assured
.extract().path();
using find
or findAll
conditions
using rest assured find
and findAll
expressions the jsonpath should be like this:
.extract().path("elements.findAll{it.type == 'TEXT' && it.properties.find{it.producesVideo == false}}.name");