JSONPath | JMeter | Condition fetch - jmeter

Using JSONPath I'm trying to fetch channels > "id": "6af38171-867c-414f-a128-6668fc66cd20" based on provided productId from different request
Example 1: for "productId": "3211a29f0c3-9180-4cd7-a5c7-282f6689c31a", channel id should be "id": "29b13081-760a-4451-81d8-25f0944b3658",
Example 2: for "productId": "321557a97a5-ef93-46b7-868c-4f26439fbcb9", channel id should be "id": "6af38171-867c-414f-a128-6668fc66cd20",
Example 3: for "productId": "321ecc29f29-bc03-41d7-b107-db3be8103216", channel id should be "id": "293e31b4-8ebb-40af-8015-44b1a37ba84f",
productId picked randomly from the previous request
$..[?(#.promotionRule.promotionProducts[0].productId=="ecc29f29-bc03-41d7-b107-db3be8103216" )].id which is coming as paramter $..[?(#.promotionRule.promotionProducts[0].productId=="${je_productId}" )].id
Payload
{
"error": null,
"data": [
{
"id": "c0c18687-26cc-48da-b60a-d386279d1c3e",
"channels": [
{
"id": "29b13081-760a-4451-81d8-25f0944b3658",
"promotionRule": {
"id": "18f84232-7350-4f9f-8037-7e92eebbc4d4",
"promotionProducts": [
{
"id": "2d755bfe-8b8f-4b2a-9bf4-e8e626975b51",
"productId": "3211a29f0c3-9180-4cd7-a5c7-282f6689c31a",
"instanceCountMin": 0,
"instanceCountMax": 0,
"promotionProductRules": [
{
"componentConstraints": [
{
"description": "Panel Amount",
"extensions": null,
"amountOfAdjustment": 0.0,
"componentConsumerSelectionType": 2,
"componentId": "8291365c-df9f-4d7b-8f34-be0b500065ee",
"options": null
}
],
"canBeCombined": false,
"priority": 0,
"promotionRecurrence": null,
"extensions": {},
"externalId": null,
"sponsorshipAppliesToEntities": [],
"createdOn": "2022-03-25T18:37:15.5161071+00:00",
"updatedOn": null,
"deletedOn": null,
"releaseOn": null,
"expireOn": null,
"expiredOn": null,
"currency": "USD",
"ruleDescription": null,
"ruleName": null,
"simulationTypes": 0,
"value": 0.0
}
]
}
],
"maxDistributionCount": null,
"selectablePromotionsMin": 1,
"selectablePromotionsMax": 1,
"canBeCombined": false,
"priority": 0,
"promotionRecurrence": null,
"extensions": {},
"externalId": null,
"sponsorshipAppliesToEntities": [],
"createdOn": "2022-03-25T18:37:15.5152919+00:00",
"updatedOn": null,
"deletedOn": null,
"releaseOn": "2022-03-25T18:37:15.5168274+00:00",
"expireOn": null,
"expiredOn": null,
"currency": "USD",
"ruleDescription": null,
"ruleName": null,
"simulationTypes": 0,
"value": 0.0
},
"authorityName": null,
"currency": "USD",
"channelName": "The Islands of The Bahamas",
"channelLogo": "https://123/cdn/BahamasTourismBoard.png",
"channelLogoHD": null,
"channelAnimated": null,
"channelAnimatedHD": null,
"sortOrder": 0,
"releaseOn": null,
"expireOn": null,
"expiredOn": null,
"suspendedOn": null,
"suspendedBy": null
}
],
"priority": 0,
"brandName": null,
"channelGroupName": "100%",
"channelGroupLogo": "https://123/media/100percentlogo.png",
"channelGroupLogoHD": "https://123/media/100percentlogo.png",
"channelGroupAnimated": null,
"channelGroupAnimatedHD": null,
"releaseOn": null,
"expireOn": null,
"expiredOn": null,
"suspendedOn": null,
"suspendedBy": null
},
{
"id": "e2de2a1f-a21b-41db-82c0-a5710cf59dee",
"channels": [
{
"id": "6af38171-867c-414f-a128-6668fc66cd20",
"promotionRule": {
"id": "074eced6-9894-4313-85e2-2a04965fc8eb",
"promotionProducts": [
{
"id": "b93ccce2-171b-4e4e-83d7-fd77632acb4f",
"productId": "321557a97a5-ef93-46b7-868c-4f26439fbcb9",
"instanceCountMin": 0,
"instanceCountMax": 0,
"promotionProductRules": [
{
"componentConstraints": [
{
"description": "Panel Amount",
"extensions": null,
"amountOfAdjustment": 0.0,
"componentConsumerSelectionType": 2,
"componentId": "a3d14456-64cb-4cae-b749-133c4b6a476a",
"options": null
},
{
"description": "Play Type",
"extensions": null,
"amountOfAdjustment": 0.0,
"componentConsumerSelectionType": 2,
"componentId": "d50aeef2-4821-4247-b712-585a2ba55f81",
"options": null
},
{
"description": "Front Number",
"extensions": null,
"amountOfAdjustment": 0.0,
"componentConsumerSelectionType": 1,
"componentId": "ed6a4930-2558-414d-b47f-a3f95e719f60",
"options": null
},
{
"description": "Middle Number",
"extensions": null,
"amountOfAdjustment": 0.0,
"componentConsumerSelectionType": 1,
"componentId": "e0957685-22d8-4827-a3db-a1e2e0b5b76b",
"options": null
},
{
"description": "Back Number",
"extensions": null,
"amountOfAdjustment": 0.0,
"componentConsumerSelectionType": 1,
"componentId": "98b3c77a-bb25-4a45-a2ca-c90a79c75ecb",
"options": null
}
],
"canBeCombined": false,
"priority": 0,
"promotionRecurrence": null,
"extensions": {},
"externalId": null,
"sponsorshipAppliesToEntities": [],
"createdOn": "2022-03-25T20:17:01.7837463+00:00",
"updatedOn": null,
"deletedOn": null,
"releaseOn": null,
"expireOn": null,
"expiredOn": null,
"currency": "USD",
"ruleDescription": null,
"ruleName": null,
"simulationTypes": 0,
"value": 0.0
}
]
}
],
"maxDistributionCount": null,
"selectablePromotionsMin": 1,
"selectablePromotionsMax": 1,
"canBeCombined": false,
"priority": 0,
"promotionRecurrence": null,
"extensions": {},
"externalId": null,
"sponsorshipAppliesToEntities": [],
"createdOn": "2022-03-25T20:17:01.7829809+00:00",
"updatedOn": null,
"deletedOn": null,
"releaseOn": "2022-03-25T20:17:01.7844511+00:00",
"expireOn": null,
"expiredOn": null,
"currency": "USD",
"ruleDescription": null,
"ruleName": null,
"simulationTypes": 0,
"value": 0.0
},
"authorityName": null,
"currency": "USD",
"channelName": "The Islands of The Bahamas",
"channelLogo": "https://123/cdn/BahamasTourismBoard.png",
"channelLogoHD": "https://123/cdn/BahamasTourismBoard.png",
"channelAnimated": null,
"channelAnimatedHD": null,
"sortOrder": 0,
"releaseOn": null,
"expireOn": null,
"expiredOn": null,
"suspendedOn": null,
"suspendedBy": null
}
],
"priority": 0,
"brandName": null,
"channelGroupName": "Pick 3",
"channelGroupLogo": "https://123/brandmedia/AcmePick3.png",
"channelGroupLogoHD": "https://123/brandmedia/AcmePick3.png",
"channelGroupAnimated": null,
"channelGroupAnimatedHD": null,
"releaseOn": null,
"expireOn": null,
"expiredOn": null,
"suspendedOn": null,
"suspendedBy": null
},
{
"id": "b234c6b1-ffba-4883-ae9a-d6483b4787ab",
"channels": [
{
"id": "293e31b4-8ebb-40af-8015-44b1a37ba84f",
"promotionRule": {
"id": "863b5465-d5ab-4433-bea2-2b0d4da0cfcc",
"promotionProducts": [
{
"id": "c5031107-3995-48d0-8f26-95597531e7e4",
"productId": "321ecc29f29-bc03-41d7-b107-db3be8103216",
"instanceCountMin": 0,
"instanceCountMax": 0,
"promotionProductRules": [
{
"componentConstraints": [
{
"description": "Panel Amount",
"extensions": null,
"amountOfAdjustment": 0.0,
"componentConsumerSelectionType": 2,
"componentId": "db7ae266-bf79-4d63-984a-aea1aa7af460",
"options": null
},
{
"description": "White Ball - 1",
"extensions": null,
"amountOfAdjustment": 0.0,
"componentConsumerSelectionType": 1,
"componentId": "8b750179-6ead-425e-b5a2-ab422e72a03e",
"options": null
},
{
"description": "White Ball - 2",
"extensions": null,
"amountOfAdjustment": 0.0,
"componentConsumerSelectionType": 1,
"componentId": "3a87a9aa-d8c8-465a-ae35-f7d894204b13",
"options": null
},
{
"description": "White Ball - 3",
"extensions": null,
"amountOfAdjustment": 0.0,
"componentConsumerSelectionType": 1,
"componentId": "6b674bc4-1143-4558-8020-88872064b6d2",
"options": null
},
{
"description": "White Ball - 4",
"extensions": null,
"amountOfAdjustment": 0.0,
"componentConsumerSelectionType": 1,
"componentId": "0cf02fdf-c717-4ea0-a230-cb837792e7f5",
"options": null
},
{
"description": "White Ball - 5",
"extensions": null,
"amountOfAdjustment": 0.0,
"componentConsumerSelectionType": 1,
"componentId": "e627485b-eb3b-4afe-a20d-bed5c30ba195",
"options": null
},
{
"description": "Powerball",
"extensions": null,
"amountOfAdjustment": 0.0,
"componentConsumerSelectionType": 1,
"componentId": "e4c6e609-954a-4707-88b5-c47993fb3f82",
"options": null
}
],
"canBeCombined": false,
"priority": 0,
"promotionRecurrence": null,
"extensions": {},
"externalId": null,
"sponsorshipAppliesToEntities": [],
"createdOn": "2022-03-25T18:44:42.9594038+00:00",
"updatedOn": null,
"deletedOn": null,
"releaseOn": null,
"expireOn": null,
"expiredOn": null,
"currency": "USD",
"ruleDescription": null,
"ruleName": null,
"simulationTypes": 0,
"value": 0.0
}
]
}
],
"maxDistributionCount": null,
"selectablePromotionsMin": 1,
"selectablePromotionsMax": 1,
"canBeCombined": false,
"priority": 0,
"promotionRecurrence": null,
"extensions": {},
"externalId": null,
"sponsorshipAppliesToEntities": [],
"createdOn": "2022-03-25T18:44:42.9586017+00:00",
"updatedOn": null,
"deletedOn": null,
"releaseOn": "2022-03-25T18:44:42.9601687+00:00",
"expireOn": null,
"expiredOn": null,
"currency": "USD",
"ruleDescription": null,
"ruleName": null,
"simulationTypes": 0,
"value": 0.0
},
"authorityName": null,
"currency": "USD",
"channelName": "The Islands of The Bahamas",
"channelLogo": "https://123/cdn/BahamasTourismBoard.png",
"channelLogoHD": "https://123/cdn/BahamasTourismBoard.png",
"channelAnimated": null,
"channelAnimatedHD": null,
"sortOrder": 0,
"releaseOn": null,
"expireOn": null,
"expiredOn": null,
"suspendedOn": null,
"suspendedBy": null
}
],
"priority": 0,
"brandName": null,
"channelGroupName": "Powerball",
"channelGroupLogo": "https://123/brandmedia/PowerballLogo.png",
"channelGroupLogoHD": "https://123/brandmedia/PowerballLogo.png",
"channelGroupAnimated": null,
"channelGroupAnimatedHD": null,
"releaseOn": null,
"expireOn": null,
"expiredOn": null,
"suspendedOn": null,
"suspendedBy": null
}
]
}

"Your" $..[?(#.promotionRule.promotionProducts[0].productId=="ecc29f29-bc03-41d7-b107-db3be8103216" )].id expression works fine for me (given I add 321 to the beginning to match response data
If it doesn't work for you - check the ${je_productId} JMeter Variable value using Debug Sampler and View Results Tree listener combination
Also be aware that JMeter Variables are not being evaluated in the "JSON Path Tester" mode of the View Results Tree listener mainly because they don't exist there.

Related

Groupby using Painless script

I want to use the painless script to group the response received after running the index. I want to group the response based on the group_id tag and return other tags also. So far, I have used the following script:
{
"size": 0,
"_source": true,
"aggs": {
"entity_group_aggregations": {
"terms": {
"field": "group_id",
"order": {
"_term": "asc"
}
}
}
}
}
However, this script is not returning the desired output.
My index response looks like the following
{
"hits": {
"total": {
"value": 8693,
"relation": "eq"
},
"max_score": 1.0,
"hits": [
{
"_index": "entity_group",
"_type": "_doc",
"_id": "100000003628-brokerAssignment-Outbound-100000000483-aldera",
"_score": 1.0,
"_source": {
"interaction_id": 100000000483,
"group_id": "AFV0001789",
"dest_status": "success",
"group_effective_date": "2021-11-30T18:30:00.000Z",
"exception_cause": "",
"executed_dest_json": [
{
"Type": "Validation",
"name": "validateGroupCountry",
"group": "sequence2",
"sequence": 20,
"resultType": "success",
"status": "processed",
"description": "Validation for group country.",
"resultReason": "Success"
},
{
"Type": "Validation",
"name": "validateProductName",
"group": "sequence2",
"sequence": 21,
"resultType": "success",
"status": "processed",
"description": "Validation for product name.",
"resultReason": "Success"
},
{
"Type": "Validation",
"name": "validateProductEffectiveDate",
"group": "sequence2",
"sequence": 22,
"resultType": "success",
"status": "processed",
"description": "Validation for product effective date.",
"resultReason": "Success"
}
],
"file_name": "brokerAssignment",
"no_of_records": 3,
"di_source": "everwellNgl",
"group_name": "CLAXTON HOBBS PHARMACY - MPA7",
"src_status": "success",
"acknowlegment_record": "{\"groupReturn\": [{\"EB ID#\": \"3391F2D6-3035-11EC-B867-DA6E058A38F8\", \" Group Number\": \"dev-MPA7\", \"Dental Group Rating EE\": null, \"Vision Group Rating EE\": \"5.7\", \"Dental Group Rating FAM\": null, \"Everwell Dental Plan ID\": \"\", \"Everwell Vision Plan ID\": \"11964\", \"Vision Group Rating FAM\": \"16.66\", \" Dental Group Number\": \"\", \" Vision Group Number\": \"AFV0001789\", \"Dental Group Rating EE+CH\": null, \"Dental Group Rating EE+SP\": null, \"Vision Group Rating EE+CH\": \"11.96\", \"Vision Group Rating EE+SP\": \"11.4\", \"Dental Minimum Participation Met\": \"\", \"Vision Minimum Participation Met\": \"Y\"}]}",
"pre_br_canonical": {
"groupDetail": {
"contacts": [
{
"faxNumbers": [
{
"faxNumber": "7702272428",
"type": "primary"
}
],
"firstName": null,
"lastName": null,
"phoneNumbers": [
{
"extension": null,
"type": "primary",
"phoneNumber": "7702272428"
}
],
"emailAddresses": [
{
"emailAddress": null,
"type": "primary"
}
],
"type": "group"
},
{
"faxNumbers": [
{
"faxNumber": null,
"type": "primary"
}
],
"firstName": "billingfn",
"lastName": "billingln",
"phoneNumbers": [
{
"extension": null,
"type": "primary",
"phoneNumber": null
}
],
"emailAddresses": [
{
"emailAddress": "contaclmail5343234#gmail.com",
"type": "primary"
}
],
"type": "billing"
},
{
"faxNumbers": [
{
"faxNumber": null,
"type": "primary"
}
],
"firstName": "contactfn",
"lastName": "contactln",
"phoneNumbers": [
{
"extension": null,
"type": "primary",
"phoneNumber": null
}
],
"emailAddresses": [
{
"emailAddress": "akajjamiapin#empoweredbenefits.com",
"type": "primary"
}
],
"type": "admin"
}
],
"transactionType": "A",
"marketer": null,
"ein": null,
"products": [
{
"plans": [
{
"planTakeOverFlag": "N",
"paymentDetail": null,
"networkID": null,
"otherInsuranceCoverageId": null,
"terminationDate": "11-30-2022",
"rating": {
"financialCode": null,
"rateTimeBasis": null,
"rateEffectiveDate": null,
"rateTerminationDate": null,
"coverageTierCode": null,
"initialRateGuaranteePeriod": null,
"rateByCoverageCode": [
{
"maxAge": null,
"rateAmount": "5.7",
"coverageCode": "EMP",
"gender": null,
"minAge": null
},
{
"maxAge": null,
"rateAmount": "11.4",
"coverageCode": "ESP",
"gender": null,
"minAge": null
},
{
"maxAge": null,
"rateAmount": "11.96",
"coverageCode": "ECH",
"gender": null,
"minAge": null
},
{
"maxAge": null,
"rateAmount": "16.66",
"coverageCode": "FAM",
"gender": null,
"minAge": null
}
],
"initialRateGuaranteePeriodType": null,
"rateTableId": null
},
"effectiveDate": "12-01-2021",
"planId": null,
"minParMet": null,
"contract": null,
"planYearType": null,
"enrolledLives": 2,
"externalPlanId": "11964",
"eligibilityValidationCode": null
}
],
"renewalDate": null,
"renewalTimeValue": null,
"product": "VIS",
"terminationDate": null,
"effectiveDate": null,
"renewalTimeBasis": null
}
],
"websiteUrl": null,
"groupName": "HOBBS PHARMACY - MPA7",
"signingProducer": {
"lastName": "agentln",
"email": "agentmailfsd2345#gmail.com",
"firstName": "agentfn",
"writingNumber": "ad126"
},
"tin": "331057747",
"associatedBrokers": [
{
"brokerId": "A123",
"brokerLastName": "Kazhamiakin",
"systemLob": null,
"primaryAgent": null,
"brokerNpn": "15341",
"customLob": null,
"terminationDate": null,
"effectiveDate": "10-18-2021",
"brokerFirstName": "Alex",
"agency": {
"agencyName": null,
"agencyId": null,
"agreementType": null
},
"commissionDetail": {
"agentLevel": null,
"commission": null,
"commissionType": "2",
"commissionPlan": null
},
"splitPercentage": "100"
}
],
"source": "EverwellGroupsetup_20211108155000_Test1.csv",
"groupType": "NGL",
"division": null,
"sicCode": "5912",
"addresses": [
{
"line1": "131 W TAYLOR ST",
"zip": "30223",
"line2": null,
"city": "GRIFFIN",
"state": "GA",
"type": "group",
"country": "US"
},
{
"line1": null,
"zip": null,
"line2": null,
"city": null,
"state": null,
"type": "billing",
"country": "US"
}
],
"businessLevel": null
},
"groupIds": [
{
"system": "everwell",
"parentId": null,
"id": "3391F2D6-3035-11EC-B867-DA6E058A38F8"
},
{
"system": "",
"parentId": null,
"id": "dev-MPA7"
},
{
"system": "",
"parentId": null,
"id": null
}
],
"groupEligibilityDetail": {
"nextRenewalDate": "12-01-2022",
"terminationDate": null,
"groupStatus": null,
"effectiveDate": "12-01-2021",
"lastRenewalDate": null,
"eligibleLives": 9,
"terminationReason": null
},
"groupConfigurations": {
"billingConfiguration": {
"billingFrequency": "M",
"paymentType": null,
"billingParameters": [
{
"billCheckDigit": null,
"paymentType": null,
"applyAutoCash": null,
"terminationDate": null,
"effectiveDate": null,
"invoiceTimingType": null,
"invoiceBasisDateType": null,
"numberOfDaysPriorACH": null,
"invoiceType": null,
"billingParameterIds": [
{
"system": "aldera",
"parentId": null,
"id": null,
"previousId": null
}
]
}
]
},
"miscellaneousConfiguration": {
"preferredLanguage": null,
"orthoMaxInitialPaymentAmount": null,
"orthoInitialPayment": null,
"erApplicationPDFfileName": "71650_CLAXTON_HO.pdf",
"programNumber": null,
"orthoMaxAdditionalPaymentAmount": null,
"orthoPaymentType": null
},
"memberEligibilityConfiguration": {
"cobValidDays": null,
"memberVerificationFrequency": null,
"memberEligibilityFrequency": null,
"memberBenefitExtensionDays": null,
"idCardProductionParmeter": null,
"memberVerificationSource": null,
"waitingMonths": 1,
"memberEligibilityType": null,
"bigLoadAutoGenMemberID": null,
"coverageCodeCalculation": null
},
"groupEligibilityConfiguration": {
"renewalNotificationDays": null,
"memberEligibilityRequired": null,
"cascadeTermToMembers": null,
"retroNumberOfPeriods": null,
"fullTimeEligibilityHours": 11,
"runOutDays": null,
"retroTimePeriodType": null,
"cascadeTermToSubGroups": null
},
"ratingConfiguration": {
"financialCode": null,
"rateTimeBasis": null,
"renewalTimeValue": null,
"rateTableDescription": null,
"genderRated": null,
"coverageTierId": null,
"renewalTimeBasis": null,
"rateTableId": null
}
}
},
"source_status": "warning",
"#version": "1",
"state": "processed",
"source_interaction_type": "sftp",
"processed_date": "2021-12-27T13:48:08.000Z",
"destination_response_result": null,
"exception_cause_source": "",
"destination": "aldera",
"file_interaction_type": "Outbound",
"dest_transaction_id": 3383,
"product": "vision",
"process": "Group",
"initialized_time": "2021-12-27T13:56:44.000Z",
"minparmet": "1",
"received_date": "2021-12-26T18:30:00.000Z",
"group_state": "GA",
"transaction_type": "add",
"destination_response_record": null,
"latest_transaction_date": "2021-12-27T13:48:08.000Z",
"source_file_id": 853,
"record_id": 100000003628,
"status": "success",
"#timestamp": "2022-08-05T10:23:49.002Z",
}
}
]
}
}

JsonPath Conditions from another array | JMETER

Using JSONPath I'm trying to fetch pools > id > options > id
based on this condition:
componentGroups > id > poolId = pools > id
"poolId": "cb720883-04f1-4be4-a416-2f0c75230768", = "id": "cb720883-04f1-4be4-a416-2f0c75230768",
I mean one of those IDs from the payload below:
Example 1:
for "poolId": "cb720883-04f1-4be4-a416-2f0c75230768", pools > id should be:
"id": "355548b5-b032-44f5-bf91-acfe987be3aa",
"id": "178709f3-f47d-4a6f-9aa1-f27958c628ea",
"id": "b0a227b0-2bf8-47cc-8422-5114edfb5c41",
"id": "ee8e2b49-7539-4ddd-90a4-6745b1385733",
Example 2:
for "poolId": "fc2ab5c-c709-4b1d-81a7-e61a8d120d8d", pools > id should be:
"id": "cf85f8ca-7686-4585-b154-2e069e7bf976",
"id": "b0f6c744-af0a-4395-a2d5-bfaf39aeeab5",
the JSON extractor I use:
$.data[?(#.productId=='1231a29f0c3-9180-4cd7-a5c7-282f6689c31a')].pools..options[?(#.componentGroups..poolId = .pools.*.id)].id
{
"error": null,
"data": [
{
"id": "d8af6a50-1bf4-4792-97ea-f9c819c60f8e",
"productId": "1231a29f0c3-9180-4cd7-a5c7-282f6689c31a",
"productName": "Acme One Hundred Percent",
"pools": [
{
"id": "cb720883-04f1-4be4-a416-2f0c75230768",
"options": [
{
"id": "355548b5-b032-44f5-bf91-acfe987be3aa",
"optionAmount": 1,
"optionIndex": 0,
"optionName": "$1",
"audio": null,
"image": "https://123./1-dollar-ball.png"
},
{
"id": "178709f3-f47d-4a6f-9aa1-f27958c628ea",
"optionAmount": 5,
"optionIndex": 1,
"optionName": "$5",
"audio": null,
"image": "https://123/5-dollar-ball.png"
},
{
"id": "b0a227b0-2bf8-47cc-8422-5114edfb5c41",
"optionAmount": 10,
"optionIndex": 2,
"optionName": "$10",
"audio": null,
"image": "https://123/10-dollar-ball.png"
},
{
"id": "ee8e2b49-7539-4ddd-90a4-6745b1385733",
"optionAmount": 20,
"optionIndex": 3,
"optionName": "$20",
"audio": null,
"image": "https://123/20-dollar-ball.png"
}
],
"poolName": "Panel Amounts",
"audio": null,
"image": null
},
{
"id": "2f1403cb-df3e-4fbf-b594-352f76943895",
"options": [
{
"id": "a5dc21e7-cc4e-4e93-b74f-1f4b19f322ef",
"optionAmount": 0,
"optionIndex": 0,
"optionName": "Heads",
"audio": null,
"image": "https://123/OneHundredPercent/LibertyBellCoin.png"
}
],
"poolName": "Heads",
"audio": null,
"image": null
}
],
"componentGroups": [
{
"id": "126140ac-1cfa-40a3-9ab7-1a84469ab0db",
"poolId": "cb720883-04f1-4be4-a416-2f0c75230768",
"components": [
{
"id": "8291365c-df9f-4d7b-8f34-be0b500065ee",
"componentConsumerSelectionType": 2,
"componentName": "Panel Amount",
"audio": null,
"image": null
}
],
"componentGroupName": "Panel Amount Components",
"audio": null,
"image": null
},
{
"id": "03ed0e60-8fba-4e01-83c2-ce960bf5e889",
"poolId": "2f1403cb-df3e-4fbf-b594-352f76943895",
"components": [
{
"id": "3f4b1a61-5d80-4b78-8c20-9f2b92022cf4",
"componentConsumerSelectionType": 1,
"componentName": "Heads",
"audio": null,
"image": null
}
],
"componentGroupName": "Heads Components",
"audio": null,
"image": null
}
]
},
{
"id": "b203c9bc-1a7e-4fe5-9b5b-d8021ea118c6",
"productId": "123557a97a5-ef93-46b7-868c-4f26439fbcb9",
"productName": "Acme Pick 3",
"pools": [
{
"id": "efc2ab5c-c709-4b1d-81a7-e61a8d120d8d",
"options": [
{
"id": "cf85f8ca-7686-4585-b154-2e069e7bf976",
"optionAmount": 0.5,
"optionIndex": 0,
"optionName": "$.50",
"audio": null,
"image": "https://123/01.png"
},
{
"id": "b0f6c744-af0a-4395-a2d5-bfaf39aeeab5",
"optionAmount": 1,
"optionIndex": 1,
"optionName": "$1",
"audio": null,
"image": "https://123/01.png"
}
],
"poolName": "Panel Amounts",
"audio": null,
"image": null
},
{
"id": "60b8910b-baa7-4776-bb7a-05f277887a11",
"options": [
{
"id": "d51485a5-1cb4-4aca-8ad9-551ac0bddce3",
"optionAmount": 0,
"optionIndex": 0,
"optionName": "Exact Order",
"audio": null,
"image": "https://123/tilestraight.png"
},
{
"id": "4ed3eaa0-7b58-47db-8072-bbe78f0e40cf",
"optionAmount": 0,
"optionIndex": 1,
"optionName": "Any Order",
"audio": null,
"image": "https://123/tilebox.png"
},
{
"id": "46571384-8bea-404b-8aa1-c0965fa0bed1",
"optionAmount": 0,
"optionIndex": 2,
"optionName": "50/50",
"audio": null,
"image": "https://123/tilefiftyfifty.png"
},
{
"id": "325d52e8-ed3f-4a69-8f09-8e49a53608dd",
"optionAmount": 0,
"optionIndex": 3,
"optionName": "Front Pair",
"audio": null,
"image": "https://123/tilefrontpair.png"
},
{
"id": "5960a4af-0b74-4c2b-b8a4-2dc4033e96a2",
"optionAmount": 0,
"optionIndex": 4,
"optionName": "Split Pair",
"audio": null,
"image": "https://123/tilesplitpair.png"
},
{
"id": "c2a817ca-1bd8-4b5b-8f6f-e12f3286ea54",
"optionAmount": 0,
"optionIndex": 5,
"optionName": "Back Pair",
"audio": null,
"image": "https://123/tilebackpair.png"
}
],
"poolName": "Play Types",
"audio": null,
"image": null
},
{
"id": "53fb7c9a-17dd-4f95-94b0-0110433404a2",
"options": [
{
"id": "fae5912c-9d4a-466b-b515-d60b3186c2e5",
"optionAmount": 0,
"optionIndex": 0,
"optionName": "0",
"audio": null,
"image": "https://123/tilegreen00.png"
},
{
"id": "42055e6a-f08a-48b4-a7c8-41b87f11ca51",
"optionAmount": 0,
"optionIndex": 1,
"optionName": "1",
"audio": null,
"image": "https://123/tilegreen01.png"
},
{
"id": "ea28a99c-6068-4d67-8e2d-c6857656b499",
"optionAmount": 0,
"optionIndex": 2,
"optionName": "2",
"audio": null,
"image": "https://123/tilegreen02.png"
},
{
"id": "bf5e29ea-a377-46ad-865d-e4585d652b13",
"optionAmount": 0,
"optionIndex": 3,
"optionName": "3",
"audio": null,
"image": "https://123/tilegreen03.png"
},
{
"id": "41c26a4b-ce86-4c28-ae5a-35c13a539fbc",
"optionAmount": 0,
"optionIndex": 4,
"optionName": "4",
"audio": null,
"image": "https://123/tilegreen04.png"
},
{
"id": "fcb34895-25b9-4e5e-8a00-652febfcd31e",
"optionAmount": 0,
"optionIndex": 5,
"optionName": "5",
"audio": null,
"image": "https://123/tilegreen05.png"
},
{
"id": "0f0cf6ef-a7b7-4d11-98c4-0ea2cfd32f39",
"optionAmount": 0,
"optionIndex": 6,
"optionName": "6",
"audio": null,
"image": "https://123/tilegreen06.png"
},
{
"id": "3db2fafd-698c-44bb-a4be-f9e43ee6248b",
"optionAmount": 0,
"optionIndex": 7,
"optionName": "7",
"audio": null,
"image": "https://123/tilegreen07.png"
},
{
"id": "25d17003-9db8-407b-b6e2-65c0c2f014a0",
"optionAmount": 0,
"optionIndex": 8,
"optionName": "8",
"audio": null,
"image": "https://123/tilegreen08.png"
},
{
"id": "37232037-ca87-4f2e-99a4-40cbfec2bf62",
"optionAmount": 0,
"optionIndex": 9,
"optionName": "9",
"audio": null,
"image": "https://123/tilegreen09.png"
}
],
"poolName": "Numbers",
"audio": null,
"image": null
}
],
"componentGroups": [
{
"id": "85ee94f1-fbcf-4392-aa08-5320abc13dcc",
"poolId": "efc2ab5c-c709-4b1d-81a7-e61a8d120d8d",
"components": [
{
"id": "a3d14456-64cb-4cae-b749-133c4b6a476a",
"componentConsumerSelectionType": 2,
"componentName": "Panel Amount",
"audio": null,
"image": null
}
],
"componentGroupName": "Panel Amount Components",
"audio": null,
"image": null
},
{
"id": "2be68fe5-2872-4631-b994-bb8e691db233",
"poolId": "60b8910b-baa7-4776-bb7a-05f277887a11",
"components": [
{
"id": "d50aeef2-4821-4247-b712-585a2ba55f81",
"componentConsumerSelectionType": 2,
"componentName": "Play Type",
"audio": null,
"image": null
}
],
"componentGroupName": "Play Type Components",
"audio": null,
"image": null
},
{
"id": "9b3433e8-48f3-4b37-bccb-e0ed5c55ffe8",
"poolId": "53fb7c9a-17dd-4f95-94b0-0110433404a2",
"components": [
{
"id": "ed6a4930-2558-414d-b47f-a3f95e719f60",
"componentConsumerSelectionType": 0,
"componentName": "Front Number",
"audio": null,
"image": null
}
],
"componentGroupName": "Front Number Components",
"audio": null,
"image": null
},
{
"id": "6ca0c5d1-0939-4603-9c0f-d6be5171a068",
"poolId": "53fb7c9a-17dd-4f95-94b0-0110433404a2",
"components": [
{
"id": "e0957685-22d8-4827-a3db-a1e2e0b5b76b",
"componentConsumerSelectionType": 0,
"componentName": "Middle Number",
"audio": null,
"image": null
}
],
"componentGroupName": "Middle Number Components",
"audio": null,
"image": null
},
{
"id": "e2ed942b-98e2-4d91-a500-ab5884acf66f",
"poolId": "53fb7c9a-17dd-4f95-94b0-0110433404a2",
"components": [
{
"id": "98b3c77a-bb25-4a45-a2ca-c90a79c75ecb",
"componentConsumerSelectionType": 0,
"componentName": "Back Number",
"audio": null,
"image": null
}
],
"componentGroupName": "Back Number Components",
"audio": null,
"image": null
}
]
}
]
}
Hard to follow what you want. Here is my attempt:
$.data[?(#.productId=='1231a29f0c3-9180-4cd7-a5c7-282f6689c31a')].pools.[*]
or, dig futher:
$.data[?(#.productId=='1231a29f0c3-9180-4cd7-a5c7-282f6689c31a')].pools.[].options[].id
Make your JSON path in two steps, perhaps. Two variables. Building-blocks.
Minor issues:
you have "=" instead of "==", see your "#.componentGroups..poolId = .pools.*.id"
careful with your path; you are, at one point, in componentGroups but expecting to be in pools
I think you need to go for 2 JSON Extractors:
Get all pool ids for the project you want:
$.data[?(#.productId=='1231a29f0c3-9180-4cd7-a5c7-282f6689c31a')].pools.*.id
it will give you a random pool id as ${pool_id} JMeter Variable
Then you will be able to get the ids like:
$.data.*.pools.*[?(#.id == '${pool_id}')].options.*.id
and this way you will get all pool ids:
You can see all the JMeter Variables with all their respective values using Debug Sampler and View Results Tree listener combination.

JsonPath Conditions | JMETER

Need help
trying to fetch all the 'id' for the componentConsumerSelectionType that equal 2 and exist under a particular "productId" ("123ecc29f29-bc03-41d7-b107-db3be8103216")
example 1:
"productId": "23451a29f0c3-9180-4cd7-a5c7-282f6689c31a"
"id": "8291365c-df9f-4d7b-8f34-be0b500065ee", (because "componentConsumerSelectionType": 2,)
example 2:
"productId": "123ecc29f29-bc03-41d7-b107-db3be8103216"
"id": "a3d14456-64cb-4cae-b749-133c4b6a476a", (because "componentConsumerSelectionType": 2,)
example 3:
"id": "a3d14456-64cb-4cae-b749-133c4b6a476a",(because "componentConsumerSelectionType": 2,)
example 2:
"id": "3f4b1a61-5d80-4b78-8c20-9f2b92022cf4", wrong (because "componentConsumerSelectionType": 1,)
I'm using this command to retrieve
$..[?(#.productId=="ecc29f29-bc03-41d7-b107-db3be8103216" && #.componentGroups[0].components[0].componentConsumerSelectionType == 2)].componentGroups[].components[].id
INPUT
{
"data": [
{
"id": "2344248b1b3-a7c5-4102-b45e-d0d6a4345329433d",
"productId": "23451a29f0c3-9180-4cd7-a5c7-282f6689c31a",
"productName": "100%",
"pools": [
{
"id": "cb720883-04f1-4be4-a416-2f0c75230768",
"options": [
{
"id": "355548b5-b032-44f5-bf91-acfe987be3aa",
"optionAmount": 1.0,
"optionIndex": 0,
"optionName": "$1",
"audio": null,
"image": "https://123/media/1-dollar-ball.png"
},
{
"id": "ee8e2b49-7539-4ddd-90a4-6745b1385733",
"optionAmount": 20.0,
"optionIndex": 3,
"optionName": "$20",
"audio": null,
"image": "https://123/media/20-dollar-ball.png"
}
],
"poolName": "FUNs",
"audio": null,
"image": null
},
{
"id": "2f1403cb-df3e-4fbf-b594-352f76943895",
"options": [
{
"id": "a5dc21e7-cc4e-4e93-b74f-1f4b19f322ef",
"optionAmount": 0.0,
"optionIndex": 0,
"optionName": "Heads",
"audio": null,
"image": "https://123/media/OneHundredPercent/LibertyBellCoin.png"
}
],
"poolName": "Heads",
"audio": null,
"image": null
}
],
"componentGroups": [
{
"id": "126140ac-1cfa-40a3-9ab7-1a84469ab0db",
"poolId": "cb720883-04f1-4be4-a416-2f0c75230768",
"components": [
{
"id": "8291365c-df9f-4d7b-8f34-be0b500065ee",
"componentConsumerSelectionType": 2,
"componentName": "FUN",
"audio": null,
"image": null
}
],
"componentGroupName": "FUN Components",
"audio": null,
"image": null
},
{
"id": "03ed0e60-8fba-4e01-83c2-ce960bf5e889",
"poolId": "2f1403cb-df3e-4fbf-b594-352f76943895",
"components": [
{
"id": "3f4b1a61-5d80-4b78-8c20-9f2b92022cf4",
"componentConsumerSelectionType": 1,
"componentName": "Heads",
"audio": null,
"image": null
}
],
"componentGroupName": "Heads Components",
"audio": null,
"image": null
}
]
},
{
"id": "b0793365-7212-44db-a044-12c213c020c2",
"productId": "123ecc29f29-bc03-41d7-b107-db3be8103216",
"productName": "FUN Powerball",
"pools": [
{
"id": "d929dd55-b0a8-4092-acff-570c638764f1",
"options": [
{
"id": "66ff00ab-0aba-479a-b96d-9f6011531440",
"optionAmount": 2.0,
"optionIndex": 0,
"optionName": "$2",
"audio": null,
"image": "https://123/media/2-dollar-ball.png"
},
{
"id": "9e6b0868-19b3-466d-bed2-7055efc1e993",
"optionAmount": 3.0,
"optionIndex": 0,
"optionName": "$2 + Power Play",
"audio": null,
"image": "https://123/media/2-dollar-ball+megaplier.png"
}
],
"poolName": "FUNs",
"audio": null,
"image": null
},
{
"id": "e63f9eea-4966-4c83-8764-28f8ba19f551",
"options": [
{
"id": "7cf2d659-2989-48f9-84f2-1dc117b52f7c",
"optionAmount": 0.0,
"optionIndex": 0,
"optionName": "1",
"audio": null,
"image": "https://123/media/01.png"
},
{
"id": "0f0fd71a-3482-4ca5-ba97-e0e1df2993db",
"optionAmount": 0.0,
"optionIndex": 64,
"optionName": "65",
"audio": null,
"image": "https://123/media/65.png"
},
{
"id": "916d4cba-b67e-4bfb-bf3e-08bff5e41e2f",
"optionAmount": 0.0,
"optionIndex": 65,
"optionName": "66",
"audio": null,
"image": "https://123/media/66.png"
},
{
"id": "7bf74431-bf68-4314-8e8d-2b28ca25706a",
"optionAmount": 0.0,
"optionIndex": 68,
"optionName": "69",
"audio": null,
"image": "https://123/media/69.png"
}
],
"poolName": "White Balls",
"audio": null,
"image": null
},
{
"id": "a93aa286-3e9e-47c6-a989-4cbd9b83d529",
"options": [
{
"id": "87550358-6a12-4184-9bbd-cd0aed629432",
"optionAmount": 0.0,
"optionIndex": 0,
"optionName": "1",
"audio": null,
"image": "https://123/media/01r.png"
},
{
"id": "fb049500-f6bd-4798-b330-d46b837b974d",
"optionAmount": 0.0,
"optionIndex": 23,
"optionName": "24",
"audio": null,
"image": "https://123/media/24r.png"
},
{
"id": "d721c27c-b44a-4ba6-9164-9b7971d92db8",
"optionAmount": 0.0,
"optionIndex": 24,
"optionName": "25",
"audio": null,
"image": "https://123/media/25r.png"
},
{
"id": "6a2ff192-7044-4991-91d1-38bbdd6c76a3",
"optionAmount": 0.0,
"optionIndex": 25,
"optionName": "26",
"audio": null,
"image": "https://123/media/26r.png"
}
],
"poolName": "Powerballs",
"audio": null,
"image": null
},
{
"id": "458199ef-e868-4639-b594-92c0d39422ea",
"options": [
{
"id": "d87d6298-85df-4c34-a2aa-b45de2d2d029",
"optionAmount": 0.0,
"optionIndex": 2,
"optionName": "x4",
"audio": null,
"image": "https://123/media/multiplier-x4.png"
},
{
"id": "f9c1842c-749e-4a4d-8d4f-55e3ce200fca",
"optionAmount": 0.0,
"optionIndex": 3,
"optionName": "x5",
"audio": null,
"image": "https://123/media/multiplier-x5.png"
},
{
"id": "57599727-d2f1-4249-b80f-0c4994244423",
"optionAmount": 0.0,
"optionIndex": 4,
"optionName": "x10",
"audio": null,
"image": "https://123/media/multiplier-x10.png"
}
],
"poolName": "Power Plays",
"audio": null,
"image": null
}
],
"componentGroups": [
{
"id": "b996b598-57e5-47f4-82a8-a1a54c70a6a9",
"poolId": "d929dd55-b0a8-4092-acff-570c638764f1",
"components": [
{
"id": "db7ae266-bf79-4d63-984a-aea1aa7af460",
"componentConsumerSelectionType": 2,
"componentName": "FUN",
"audio": null,
"image": null
}
],
"componentGroupName": "FUN Components",
"audio": null,
"image": null
},
{
"id": "be80677c-114b-4200-a625-badd301373a6",
"poolId": "e63f9eea-4966-4c83-8764-28f8ba19f551",
"components": [
{
"id": "8b750179-6ead-425e-b5a2-ab422e72a03e",
"componentConsumerSelectionType": 0,
"componentName": "White Ball - 1",
"audio": null,
"image": null
},
{
"id": "3a87a9aa-d8c8-465a-ae35-f7d894204b13",
"componentConsumerSelectionType": 0,
"componentName": "White Ball - 2",
"audio": null,
"image": null
},
{
"id": "6b674bc4-1143-4558-8020-88872064b6d2",
"componentConsumerSelectionType": 0,
"componentName": "White Ball - 3",
"audio": null,
"image": null
},
{
"id": "0cf02fdf-c717-4ea0-a230-cb837792e7f5",
"componentConsumerSelectionType": 0,
"componentName": "White Ball - 4",
"audio": null,
"image": null
},
{
"id": "e627485b-eb3b-4afe-a20d-bed5c30ba195",
"componentConsumerSelectionType": 0,
"componentName": "White Ball - 5",
"audio": null,
"image": null
}
],
"componentGroupName": "White Ball Components",
"audio": null,
"image": null
},
{
"id": "00757a5a-a544-4f4f-985b-60d516a999b6",
"poolId": "a93aa286-3e9e-47c6-a989-4cbd9b83d529",
"components": [
{
"id": "e4c6e609-954a-4707-88b5-c47993fb3f82",
"componentConsumerSelectionType": 0,
"componentName": "Powerball",
"audio": null,
"image": null
}
],
"componentGroupName": "Powerball Components",
"audio": null,
"image": null
},
{
"id": "eb50e66d-fb77-4d7c-845a-b9492a4c29d1",
"poolId": "458199ef-e868-4639-b594-92c0d39422ea",
"components": [
{
"id": "21a81d68-d9c1-4bea-ad7f-5656584fb37c",
"componentConsumerSelectionType": 1,
"componentName": "Power Play",
"audio": null,
"image": null
}
],
"componentGroupName": "Power Play Components",
"audio": null,
"image": null
}
]
},
{
"id": "a7bb18a0-9231-4e04-8542-4a86fe4f7f25",
"productId": "557a97a5-ef93-46b7-868c-4f26439fbcb9",
"productName": "FUN Pick 3",
"pools": [
{
"id": "efc2ab5c-c709-4b1d-81a7-e61a8d120d8d",
"options": [
{
"id": "cf85f8ca-7686-4585-b154-2e069e7bf976",
"optionAmount": 0.50,
"optionIndex": 0,
"optionName": "$.50",
"audio": null,
"image": "https://123/media/01.png"
},
{
"id": "b0f6c744-af0a-4395-a2d5-bfaf39aeeab5",
"optionAmount": 1.0,
"optionIndex": 1,
"optionName": "$1",
"audio": null,
"image": "https://123/media/01.png"
}
],
"poolName": "FUNs",
"audio": null,
"image": null
},
{
"id": "60b8910b-baa7-4776-bb7a-05f277887a11",
"options": [
{
"id": "5960a4af-0b74-4c2b-b8a4-2dc4033e96a2",
"optionAmount": 0.0,
"optionIndex": 4,
"optionName": "Split Pair",
"audio": null,
"image": "https://123/media/tilesplitpair.png"
},
{
"id": "c2a817ca-1bd8-4b5b-8f6f-e12f3286ea54",
"optionAmount": 0.0,
"optionIndex": 5,
"optionName": "Back Pair",
"audio": null,
"image": "https://123/media/tilebackpair.png"
}
],
"poolName": "Play Types",
"audio": null,
"image": null
},
{
"id": "53fb7c9a-17dd-4f95-94b0-0110433404a2",
"options": [
{
"id": "fae5912c-9d4a-466b-b515-d60b3186c2e5",
"optionAmount": 0.0,
"optionIndex": 0,
"optionName": "0",
"audio": null,
"image": "https://123/media/tilegreen00.png"
},
{
"id": "42055e6a-f08a-48b4-a7c8-41b87f11ca51",
"optionAmount": 0.0,
"optionIndex": 1,
"optionName": "1",
"audio": null,
"image": "https://123/media/tilegreen01.png"
},
{
"id": "ea28a99c-6068-4d67-8e2d-c6857656b499",
"optionAmount": 0.0,
"optionIndex": 2,
"optionName": "2",
"audio": null,
"image": "https://123/media/tilegreen02.png"
},
{
"id": "bf5e29ea-a377-46ad-865d-e4585d652b13",
"optionAmount": 0.0,
"optionIndex": 3,
"optionName": "3",
"audio": null,
"image": "https://123/media/tilegreen03.png"
},
{
"id": "41c26a4b-ce86-4c28-ae5a-35c13a539fbc",
"optionAmount": 0.0,
"optionIndex": 4,
"optionName": "4",
"audio": null,
"image": "https://123/media/tilegreen04.png"
},
{
"id": "fcb34895-25b9-4e5e-8a00-652febfcd31e",
"optionAmount": 0.0,
"optionIndex": 5,
"optionName": "5",
"audio": null,
"image": "https://123/media/tilegreen05.png"
},
{
"id": "0f0cf6ef-a7b7-4d11-98c4-0ea2cfd32f39",
"optionAmount": 0.0,
"optionIndex": 6,
"optionName": "6",
"audio": null,
"image": "https://123/media/tilegreen06.png"
},
{
"id": "3db2fafd-698c-44bb-a4be-f9e43ee6248b",
"optionAmount": 0.0,
"optionIndex": 7,
"optionName": "7",
"audio": null,
"image": "https://123/media/tilegreen07.png"
},
{
"id": "25d17003-9db8-407b-b6e2-65c0c2f014a0",
"optionAmount": 0.0,
"optionIndex": 8,
"optionName": "8",
"audio": null,
"image": "https://123/media/tilegreen08.png"
},
{
"id": "37232037-ca87-4f2e-99a4-40cbfec2bf62",
"optionAmount": 0.0,
"optionIndex": 9,
"optionName": "9",
"audio": null,
"image": "https://123/media/tilegreen09.png"
}
],
"poolName": "Numbers",
"audio": null,
"image": null
}
],
"componentGroups": [
{
"id": "85ee94f1-fbcf-4392-aa08-5320abc13dcc",
"poolId": "efc2ab5c-c709-4b1d-81a7-e61a8d120d8d",
"components": [
{
"id": "a3d14456-64cb-4cae-b749-133c4b6a476a",
"componentConsumerSelectionType": 2,
"componentName": "FUN",
"audio": null,
"image": null
}
],
"componentGroupName": "FUN Components",
"audio": null,
"image": null
},
{
"id": "2be68fe5-2872-4631-b994-bb8e691db233",
"poolId": "60b8910b-baa7-4776-bb7a-05f277887a11",
"components": [
{
"id": "d50aeef2-4821-4247-b712-585a2ba55f81",
"componentConsumerSelectionType": 2,
"componentName": "Play Type",
"audio": null,
"image": null
}
],
"componentGroupName": "Play Type Components",
"audio": null,
"image": null
},
{
"id": "9b3433e8-48f3-4b37-bccb-e0ed5c55ffe8",
"poolId": "53fb7c9a-17dd-4f95-94b0-0110433404a2",
"components": [
{
"id": "ed6a4930-2558-414d-b47f-a3f95e719f60",
"componentConsumerSelectionType": 0,
"componentName": "Front Number",
"audio": null,
"image": null
}
],
"componentGroupName": "Front Number Components",
"audio": null,
"image": null
},
{
"id": "6ca0c5d1-0939-4603-9c0f-d6be5171a068",
"poolId": "53fb7c9a-17dd-4f95-94b0-0110433404a2",
"components": [
{
"id": "e0957685-22d8-4827-a3db-a1e2e0b5b76b",
"componentConsumerSelectionType": 0,
"componentName": "Middle Number",
"audio": null,
"image": null
}
],
"componentGroupName": "Middle Number Components",
"audio": null,
"image": null
},
{
"id": "e2ed942b-98e2-4d91-a500-ab5884acf66f",
"poolId": "53fb7c9a-17dd-4f95-94b0-0110433404a2",
"components": [
{
"id": "98b3c77a-bb25-4a45-a2ca-c90a79c75ecb",
"componentConsumerSelectionType": 0,
"componentName": "Back Number",
"audio": null,
"image": null
}
],
"componentGroupName": "Back Number Components",
"audio": null,
"image": null
}
]
}
]
}
If I'm correctly getting your requirement the only id which matches your criteria would be db7ae266-bf79-4d63-984a-aea1aa7af460 and it can be fetched using the following JsonPath expression:
$.data[?(#.productId == '123ecc29f29-bc03-41d7-b107-db3be8103216')].componentGroups.*.components[?(#.componentConsumerSelectionType == 2)].id
Demo (assumes JsonPath Tester mode of the View Results Tree listener):
More information: JMeter's JSON Path Extractor Plugin - Advanced Usage Scenarios

Issue trying to assert Response structure based on type

Laravel Version: 6.20.30
PHP Version: 7.2.8
Database Driver & Version: Mysql 5.7
Description:
The issue I'm facing is that I need to test the structure of a response in which some properties are look-alike
Steps To Reproduce:
this is the response to test against :
[
{
"id": 1,
"product_id": 1,
"section_id": 1,
"image_id": null,
"html_id": 1,
"index": 0,
"name": "zip_2MB",
"description": "Error ex sed numquam et odit minima quia sunt. Praesentium in ea numquam. Alias ut pariatur voluptates modi velit veniam aspernatur accusantium. Aut facilis minus reprehenderit praesentium eum.",
"title": "Slide #53",
"backup": false,
"required": true,
"emailable": 0,
"type": 0,
"asset_id": null,
"thumb_id": null,
"image": null,
"html": {
"id": 1,
"product_id": 1,
"zip_id": 1,
"thumb_id": 1,
"name": "zip_2MB",
"rank": 0,
"created_at": "2021-08-11 13:24:42",
"updated_at": "2021-08-11 13:24:42",
"deleted_at": null,
"thumb": {
"id": 1,
"user_id": null,
"key": "archive/zip_2MB.zip",
"bucket": "symmetryk-assets-testing",
"region": "eu-west-2",
"cdnURL": "https://symmetryk-assets-testing.s3.eu-west-2.amazonaws.com/archive/zip_2MB.zip",
"size": 2036861,
"size_thumb": 0,
"size_preview": 0,
"mime_type": "application/zip",
"extension": "zip",
"width": null,
"height": null,
"duration": null,
"viewed": null,
"created_at": "2021-08-11 13:24:42",
"updated_at": "2021-08-11 13:24:42",
"deleted_at": null
},
"html": {
"id": 1,
"user_id": null,
"key": "archive/zip_2MB.zip",
"bucket": "symmetryk-assets-testing",
"region": "eu-west-2",
"cdnURL": "https://symmetryk-assets-testing.s3.eu-west-2.amazonaws.com/archive/zip_2MB.zip",
"size": 2036861,
"size_thumb": 0,
"size_preview": 0,
"mime_type": "application/zip",
"extension": "zip",
"width": null,
"height": null,
"duration": null,
"viewed": null,
"created_at": "2021-08-11 13:24:42",
"updated_at": "2021-08-11 13:24:42",
"deleted_at": null
}
}
},
{
"id": 2,
"product_id": 1,
"section_id": 1,
"image_id": 2,
"html_id": null,
"index": 1,
"name": "file_example_JPG_500kB",
"description": "Et voluptatem et corporis in.",
"title": "Slide #78",
"backup": false,
"required": false,
"emailable": 0,
"type": 2,
"asset_id": 2,
"thumb_id": 2,
"image": {
"id": 2,
"product_id": 1,
"image_id": 2,
"thumb_id": 2,
"name": "file_example_JPG_500kB",
"rank": 1,
"created_at": "2021-08-11 13:25:23",
"updated_at": "2021-08-11 13:25:23",
"deleted_at": null,
"thumb": {
"id": 2,
"user_id": null,
"key": "image/file_example_JPG_500kB.jpeg",
"bucket": "symmetryk-assets-testing",
"region": "eu-west-2",
"cdnURL": "https://symmetryk-assets-testing.s3.eu-west-2.amazonaws.com/image/file_example_JPG_500kB.jpeg",
"size": 555181,
"size_thumb": 0,
"size_preview": 0,
"mime_type": "image/jpeg",
"extension": "jpeg",
"width": null,
"height": null,
"duration": null,
"viewed": null,
"created_at": "2021-08-11 13:25:23",
"updated_at": "2021-08-11 13:25:23",
"deleted_at": null
},
"image": {
"id": 2,
"user_id": null,
"key": "image/file_example_JPG_500kB.jpeg",
"bucket": "symmetryk-assets-testing",
"region": "eu-west-2",
"cdnURL": "https://symmetryk-assets-testing.s3.eu-west-2.amazonaws.com/image/file_example_JPG_500kB.jpeg",
"size": 555181,
"size_thumb": 0,
"size_preview": 0,
"mime_type": "image/jpeg",
"extension": "jpeg",
"width": null,
"height": null,
"duration": null,
"viewed": null,
"created_at": "2021-08-11 13:25:23",
"updated_at": "2021-08-11 13:25:23",
"deleted_at": null
}
},
"html": null
}
]
this is can be returned from a route for easy testing.
$request = $this->get('/dummy-url-to-return-the-response');
$request
->assertJsonStructure(
[
'*' => [
'id',
'product_id',
'section_id',
'image_id',
'html_id',
'index',
'name',
'description',
'title',
'backup',
'required',
'emailable',
'type',
'asset_id',
'thumb_id',
'image' => [
'*' => [
'id',
'product_id',
'image',
'thumb'
]
],
'html' => [
'*' => [
'id',
'product_id',
'image',
'thumb'
]
]
]
]
)
If an object have an html object, the image object is null and vis versa.
Keep in mind that the structure was truncated for easier follow so assuming that I am writing this correctly, this is the message I keep getting.
Argument #2 of PHPUnit\Framework\Assert::assertArrayHasKey() must be an array or ArrayAccess

Decimal error in brain tree dashboard

When I am making transaction through braintree payment gateway I get the response which I have attached below the amount returned is 1200 but in the braintree dashboard I get 1.200 (decimal).
"PAYMENT": {
"transaction": {
"id": "dhsaj2vy",
"status": "submitted_for_settlement",
"type": "sale",
"currencyIsoCode": "EUR",
"amount": "1200.00",
"merchantAccountId": "5646466767909",
"subMerchantAccountId": null,
"masterMerchantAccountId": null,
"orderId": null,
"createdAt": "2017-08-19T13:05:47Z",
"updatedAt": "2017-08-19T13:05:47Z",
"customer": {
"id": "8239041739880",
"firstName": "a#g.com",
"lastName": "",
"company": null,
"email": null,
"website": null,
"phone": null,
"fax": null
},
"billing": {
"id": "ff",
"firstName": null,
"lastName": null,
"company": null,
"streetAddress": null,
"extendedAddress": null,
"locality": null,
"region": null,
"postalCode": "5328",
"countryName": null,
"countryCodeAlpha2": null,
"countryCodeAlpha3": null,
"countryCodeNumeric": null
},
"refundId": null,
"refundIds": [],
"refundedTransactionId": null,
"partialSettlementTransactionIds": [],
"authorizedTransactionId": null,
"settlementBatchId": null,
"shipping": {
"id": null,
"firstName": null,
"lastName": null,
"company": null,
"streetAddress": null,
"extendedAddress": null,
"locality": null,
"region": null,
"postalCode": null,
"countryName": null,
"countryCodeAlpha2": null,
"countryCodeAlpha3": null,
"countryCodeNumeric": null
},
"customFields": "",
"avsErrorResponseCode": null,
"avsPostalCodeResponseCode": "M",
"avsStreetAddressResponseCode": "I",
"cvvResponseCode": "I",
"gatewayRejectionReason": null,
"processorAuthorizationCode": "F6D7CV",
"processorResponseCode": "1000",
"processorResponseText": "Approved",
"additionalProcessorResponse": null,
"voiceReferralNumber": null,
"purchaseOrderNumber": null,
"taxAmount": null,
"taxExempt": false,
"creditCard": {
"token": "6wh2v4",
"bin": "555555",
"last4": "4444",
"cardType": "MasterCard",
"expirationMonth": "12",
"expirationYear": "2025",
"customerLocation": "US",
"cardholderName": null,
"imageUrl": "https://assets.braintreegateway.com/payment_method_logo/mastercard.png?environment=sandbox",
"prepaid": "Unknown",
"healthcare": "Unknown",
"debit": "Unknown",
"durbinRegulated": "Unknown",
"commercial": "Unknown",
"payroll": "Unknown",
"issuingBank": "Unknown",
"countryOfIssuance": "Unknown",
"productId": "Unknown",
"uniqueNumberIdentifier": "4522ba536b44dec3d9d7a7cc3b059d1e",
"venmoSdk": false,
"maskedNumber": "555555******4444",
"expirationDate": "12/2025"
},
"statusHistory": [{
"timestamp": "2017-08-19T13:05:47Z",
"status": "authorized",
"amount": "12011.00",
"user": "g5bareja#gmail.com",
"transactionSource": "api"
}, {
"timestamp": "2017-08-19T13:05:47Z",
"status": "submitted_for_settlement",
"amount": "1200.00",
"user": "g5bareja#gmail.com",
"transactionSource": "api"
}],
"planId": null,
"subscriptionId": null,
"subscription": {
"billingPeriodEndDate": null,
"billingPeriodStartDate": null
},
"addOns": [],
"discounts": [],
"descriptor": {
"name": null,
"phone": null,
"url": null
},
"recurring": false,
"channel": null,
"serviceFeeAmount": null,
"escrowStatus": null,
"disbursementDetails": {
"disbursementDate": null,
"settlementAmount": null,
"settlementCurrencyIsoCode": null,
"settlementCurrencyExchangeRate": null,
"fundsHeld": null,
"success": null
},
"disputes": [],
"authorizationAdjustments": [],
"paymentInstrumentType": "credit_card",
"processorSettlementResponseCode": "",
"processorSettlementResponseText": "",
"threeDSecureInfo": null,
"paypalAccount": {},
"coinbaseAccount": {},
"applePayCard": {}
},
But in dashboard I see 1.200 why is there error in decimal points when braintree is returning me the correct amount?
Full disclosure: I work at Braintree. If you have any further questions, feel free to contact support.
What you see in your Dashboard is the correct format of Euro currency denoting the value one thousand two hundred.
A quick search for proper formatting of Euro currency shows that the decimal separator is a "," and the thousands separator is a ".". Here's an example contrasting EUR and USD:
EUR 1.200,00
USD 1,200.00
Braintree adheres to the standard format of the currencies it supports.

Resources