jsongroovyjmeterbeanshellextractor

JMeter - Extract value from the variable having JSON data


I am getting following response in one GET API call.

{
  "id": 78929,
  "created": "04-12-2021 02:37:52",
  "modified": "04-12-2021 02:37:52",
  "name": "Applebee",
  "url": "https://applebee-2.prashant.com",
  "key1": "vp_9d254bb754ab6283afa9ecf0f0847b5a",
  "interval2": 120,
  "tenant_id": 60895,
  "channel_id": 2,
  "channel_type": "platform",
  "warehouse_id": 54533,
  "warehouse_name": "Bedfordview Warehouse",
  "stock_policy": "CUSTOM",
  "currency_id": 45396,
  "order_from_date": "2021-10-03 02:36:48",
  "inventory_update": true,
  "order_update": true,
  "price_update": true,
  "active": true,
  "resync": true,
  "last_access_record_id": 89880,
  "last_accessed_record": {
    "id": 89880,
    "last_order_to_date": "2021-12-07T00:16:39.000+0000",
    "last_order_id": "0",
    "last_order_page": 1
  },
  "store_config": "{\"isOrderUpdateProcessor\":false,\"auto_archive\":true,\"tagOrderRisks\":true,\"error_emails\":\"kyle@gmail.com\",\"autoMapDuplicateProduct\":true,\"enabledMultiCurrency\":false,\"disableSyncPIIData\":false}",
  "last_inventory_sync": "04-12-2021 02:43:35",
  "inventory_sync_interval": 1440,
  "stock_policy_warehouse_ids": [
    {
      "id": 53543,
      "created": "04-12-2021 02:37:52",
      "modified": "04-12-2021 02:37:52",
      "store_id": 78929,
      "external_warehouse_id": "34639577171",
      "warehouse_id": 54533,
      "add_qty_value": "0%",
      "add_incoming_qty_value": "0%",
      "tenant_id": 60895
    },
    {
      "id": 53544,
      "created": "04-12-2021 02:37:52",
      "modified": "04-12-2021 02:37:52",
      "store_id": 78929,
      "external_warehouse_id": "60921610323",
      "warehouse_id": 54534,
      "add_qty_value": "0%",
      "add_incoming_qty_value": "0%",
      "tenant_id": 60895
    }
  ],
  "old_shopify_locations": [
    {
      "id": "60921610323",
      "name": "Supplier",
      "warehouseId": 54534,
      "warehouseName": "Lux"
    },
    {
      "id": "34639577171",
      "name": "Bedfordview Warehouse",
      "warehouseId": 54533,
      "warehouseName": "Bedfordview Warehouse"
    }
  ]
}

I have added following JSON Extractor to fetch store_config value from the above API response.

enter image description here

So as per above example, I am getting following store_config value via JSON Extractor.

{
  "isOrderUpdateProcessor": false,
  "auto_archive": true,
  "tagOrderRisks": true,
  "error_emails": "kyle@gmail.com",
  "autoMapDuplicateProduct": true,
  "enabledMultiCurrency": false,
  "disableSyncPIIData": false
}

So Now, I want to fetch "isOrderUpdateProcessor" value from the above store_config variable.

So please help me into this.


Solution

  • You can use another JSON Extractor to extract from your variable by choosing the radio button JMeter variable and add your expression as$.isOrderUpdateProcessor and save result in a new variable