Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Want to extract particular value from the response and pass it on to next request

Have the following JSON body fetched from JSON extractor using a expression $.namespaces[?(@.type=='account_id')].permissions,

Result[0]=
{
    "query_view_only_own": 0,
    "location_view": 1,
    "user_modify_notifications": 1,
    "customcode_edit": 0,
    "link_edit": 0,
    "dictionary_view": 0,
    "study_field_customfield_6385aa2c-f79f-4670-b8b7-9136ebd75ed5": "F",
    "study_field_patientid": "F",
    "study_field_customfield_9bff67fb-f18e-4de1-982c-1798376881b1": "H",
    "study_report_hl7_view_unapproved": 0,
    "customfield_edit": 1,
    "study_push": 1,
    "message_edit": 1,
    "radreport_edit": 0,
    "destination_search_mwl": 0,
    "site_qualify": 1,
    "group_view": 1,
    "hl7_template_edit": 0,
    "study_field_customfield_77bd643b-28fe-4306-b08b-33ea96bfa200": "F",
    "study_merge": 0,
    "route_edit": 1,
    "study_report_delete_approved": 1,
    "site_delete": 0,
    "study_report_view_unapproved": 0,
    "site_edit": 0,
    "terminology_edit": 1,
    "query_view_meta": 1,
    "query_attachment_view": 1,
    "study_report_detail": 1,
    "role_edit": 1,
    "radreport_view_only_own": 0,
    "case_edit": 0,
    "qctask_prioritize": 1,
    "study_duplicate": 0,
    "query_view": 1,
    "study_field_study_description": "F",
    "destination_edit": 1,
    "scanner_view": 0,
    "analytics_view": 1,
    "case_view": 0,
    "validate_view": 0,
    "case_edit_only_own": 0,
    "job_view": 1,
    "hl7_transform_view": 0,
    "ui_json": "",
    "appointment_edit": 0,
    "dicomdata_view": 1,
    "user_modify_others_email": 1,
    "audit_view": 1,
    "study_share_group": 1,
    "account_user_edit": 1,
    "account_view": 1,
    "meeting_view": 1,
    "patient_view": 0,
    "webhook_run": 1,
    "customfield_view": 1,
    "customfield_list": 1,
    "study_download": 1,
    "message_view": 1,
    "radreport_view": 0,
    "study_share_rsna": 0,
    "study_thin": 0,
    "qctask_add": 1,
    "study_browse": 1,
    "study_sync": 0,
    "hl7_message_view": 0,
    "study_delete_image": 0,
    "user_modify_others_pkey": 0,
    "viewer_config": "",
    "study_view": 1,
    "account_user_invite": 1,
    "study_request_view_inbound": 0,
    "study_share_user": 1,
    "qctask_edit": 1,
    "study_field_patient_birth_date": "F",
    "site_view": 0,
    "study_report_hl7_view": 1,
    "study_upload": 1,
    "study_field_customfield_987eb6cd-6e63-4605-812a-06600e721493": "H",
    "study_field_customfield_4b2e868b-2438-4597-a8fd-d639ccff942c": "F",
    "dictionary_edit": 0,
    "route_view": 1,
    "study_clone": 0,
    "study_share_location": 1,
    "location_edit": 1,
    "user_setting_set": 0,
    "role_view": 1,
    "study_status_edit": 0,
    "study_report_delete_unapproved": 0,
    "study_star": 1,
    "user_modify_others_notifications": 0,
    "query_edit": 1,
    "pathology_upload": 1,
    "study_report_delete": 1,
    "channel_activity": 1,
    "study_field_customfield_8d1fbaeb-c9f2-420c-ad53-73ebc5dfb425": "F",
    "destination_search": 0,
    "user_modify_defaults": 1,
    "patient_edit": 0,
    "sharing_rule_edit": 1,
    "study_field_customfield_f3caaa4d-ec29-4148-9055-90ca3594a276": "F",
    "study_approve": 1,
    "node_edit_own": 0,
    "site_user_delete": 0,
    "query_attachment_delete": 1,
    "link_edit_upload": 0,
    "terminology_view": 1,
    "dicomdata_edit": 1,
    "query_add": 1,
    "study_report_upload": 1,
    "study_take": 0,
    "link_view": 0,
    "study_comment_view": 0,
    "customcode_deploy": 0,
    "hl7_transform_edit": 0,
    "qctask_delete": 1,
    "hl7_template_view": 0,
    "webhook_edit": 1,
    "site_user_add": 0,
    "link_direct": 1,
    "study_report_view_only_own": 0,
    "namespace_question": 1,
    "study_search_require_patient_birth_date": 0,
    "node_view": 1,
    "purge_edit": 0,
    "study_request_view": 0,
    "study_edit_unapproved": 1,
    "study_send_status_view": 1,
    "study_comment_edit": 0,
    "study_duplicate_request": 0,
    "case_view_only_own": 0,
    "study_delete": 0,
    "study_report_view": 1,
    "annotation_view": 1,
    "account_user_view": 1,
    "study_field_referring_physician": "F",
    "study_share_share_code": 1,
    "case_delete": 0,
    "study_field_customfield_1fe37b5d-c830-41cd-9beb-06df42c69eb0": "F",
    "study_field_patient_name": "F",
    "study_edit_approved": 1,
    "setting_ip_whitelist": 1,
    "filter_edit_only_own": 0,
    "study_report_hl7_view_approved": 1,
    "location_clone": 0,
    "site_user_view": 0,
    "study_manual_route": 0,
    "query_attachment_add": 1,
    "can_proxy_login": 0,
    "study_move": 0,
    "appointment_view_only_own": 0,
    "study_search_require_patient_sex": 0,
    "query_attachment_delete_only_own": 1,
    "radreport_html_format": 0,
    "study_field_modality": "F",
    "user_view_others_notifications": 0,
    "study_status_view": 0,
    "setting_pacs_config_customized": 1,
    "study_report_view_approved": 1,
    "order_edit": 0,
    "group_clone": 0,
    "annotation_view_only_own": 0,
    "study_share": 1,
    "webhook_view": 1,
    "study_download_viewer": 1,
    "keyimage_view": 1,
    "study_tag": 1,
    "study_request_view_only_own": 0,
    "study_share_email": 0,
    "study_report_upload_unapproved": 0,
    "research_edit": 0,
    "scanner_add": 0,
    "accelerator_edit": 1,
    "qctask_view": 1,
    "study_download_iso": 1,
    "sharing_rule_view": 1,
    "study_edit": 1,
    "scanner_delete": 0,
    "user_request_access": 1,
    "research_view": 0,
    "study_field_customfield_6480baa2-cd2c-4c60-be92-ddcd09675c45": "H",
    "link_edit_pin": 0,
    "annotation_edit_only_own": 1,
    "study_timing_view": 0,
    "site_user_edit": 0,
    "study_field_customfield_2ac756f4-c7be-4bb4-90ed-78e36266ade5": "F",
    "hl7_message_delete": 0,
    "study_request_edit": 0,
    "annotation_edit": 1,
    "study_split": 0,
    "appointment_view": 0,
    "study_audio_play": 0,
    "node_edit": 1,
    "channel_study": 1,
    "role_setting_edit": 1,
    "query_reply": 1,
    "scanner_validate": 1,
    "group_edit": 1,
    "purge_view": 0,
    "query_delete": 1,
    "study_status_tags_ignore_rules": 1,
    "scanner_edit": 0,
    "study_field_accession_number": "F",
    "customcode_view": 0,
    "user_modify_sharecode": 1,
    "study_field_patient_sex": "F",
    "study_field_study_date": "F",
    "study_search_require_patientid": 0,
    "user_edit_shared_filter": 0,
    "patient_merge": 0,
    "viewer3_config": "",
    "study_share_request": 0,
    "accelerator_view": 1,
    "filter_share": 1,
    "user_edit": 1,
    "study_field_customfield_dfb98397-2a6d-4075-a4d0-8684cdcde9d9": "F",
    "study_freeze": 0,
    "study_audio_record": 0,
    "study_search_require_patient_name": 0,
    "node_approve_connect": 1,
    "account_edit": 1,
    "study_share_account": 1,
    "meeting_edit": 0,
    "study_status_manual_edit": 1,
    "node_connect": 1,
    "order_view": 0,
    "validate_edit": 0,
    "keyimage_edit": 1,
    "study_search_require_accession_number": 0,
    "site_add": 0,
    "study_upload_validate": 0,
    "destination_view": 1,
    "study_share_npi": 0,
    "study_report_upload_approved": 1
}

What fetch all the study_field_customfield_ and the corresponding value "H" and pass is inside next json request object how to do it in JMeter ?

part of next request JSON is,

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

"study_field_accession_number": "F",
    "study_field_modality": "F",
    "study_field_patientid": "F",
    "study_field_patient_birth_date": "F",
    "study_field_patient_name": "F",
    "study_field_patient_sex": "F",
    "study_field_referring_physician": "F",
    "study_field_study_date": "F",
    "study_field_study_description": "F",
    "study_field_customfield_90eb00fa-ae75-4125-bd03-f8793b2a8ef0": "F",
    "study_field_customfield_fcfca2fe-308d-48ac-80a6-e2f49e313151": "F",
    "study_field_customfield_4420ac5e-6d4f-4b02-8a44-24871f97861b": "H",
    "study_field_customfield_70d1c4de-dbd4-47e5-9f1f-4f3e323e25ed": "H",
    "study_field_customfield_c3243b67-4982-40c5-b5c9-ce64811425e2": "F",
    "study_field_customfield_c3fb12a2-d89b-4427-be45-7c92a9c7ef70": "F",
    "study_field_customfield_89755cc7-8df0-44c4-98bb-6e0767684bd4": "F",
    "study_field_customfield_a46034ac-2bf9-4d9d-a815-20cf86155a37": "H",
    "study_field_customfield_f4095a86-12cf-4482-958d-1a3b012f83be": "F",
    "study_field_customfield_b0ba863e-5f8c-43a6-8890-8afc1af2d460": "F",
    "study_field_customfield_4a41f25b-677e-4f81-bb74-00c54a010833": "F",
    "setting_pacs_config_customized": 1

Cannot hardcoded it as study_field_customfield_4a41f25b-677e-4f81-bb74-00c54a010833 they keep on changing for every other request.

I tried with following but it is giving me blank value,

import groovy.json.JsonSlurper;

def extractedValue = vars.get("pre_responseJSON");

def customeField = new groovy.json.JsonSlurper().parseText(extractedValue).permissions.findAll{
        it.getKey().startsWith('study_field_customfield_')
        };

log.info(":"+customeField+":"); 

enter image description here

enter image description here

>Solution :

There is no permissions object in your variable, you should remove it from the filtering code snippet like:

def customeField = new groovy.json.JsonSlurper().parseText(extractedValue).findAll{
    it.getKey().startsWith('study_field_customfield_')
}

More information:

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading