JSON提取器:
$.Data[0].CartItems[0].UID
XPath提取器:
返回數據格式是HTML的時候,選擇使用此種方式。
//input[@id='storageId']/@value
正則表達式提取器:
圖中Field to check勾選的是Response Headers,獲取的是請求頭里的參數值。
Bean Shell PostProcessor腳本獲取方式:
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
String jsonContent = prev.getResponseDataAsString();
JSONObject response = JSON.parseObject(jsonContent);
JSONArray phaseList = response.getJSONArray("phaseList");
JSONObject phase = phaseList.getJSONObject(0);
String ChannelOrderNo = phase.getString("ChannelOrderNo");
vars.put("ChannelOrderNo", ChannelOrderNo);