0
我有一個關於獲取從jmeter中的第一個請求獲得的json響應的一部分以形成一個新的HTTP請求的查詢。用Jmeter解析JSON以傳遞一個JSON數組,因爲它從之前的HTTP響應傳遞到一個新的HTTP請求
我想用雙引號和冒號作爲第二個HTTP請求的一部分提取1塊信息json(原樣)。
{
"details": [
{
"outBound": [
{
"info": {
"date": "2016-08-11",
"class": "M",
"code": 70,
"pricing": [
{
"totalAmount": 68.8,
"totalTaxAmount": 30.8,
"baseFareAmount": 38.0
}
],
"totalAmount": 68.8,
"totalDuration": 160,
"referenceNumber": 1,
"type": "RP",
"id": 1
},
"segments": [
{
"date": "2016-08-11",
"className": "Standard (W)",
"code": 70,
"totalAmount": 68.8,
"totalDuration": 160,
"referenceNumber": 1,
"type": "RP",
"duration": 160,
"number": "100"
}
]
},
{
"info": {
"date": "2016-08-11",
"class": "M",
"code": 70,
"pricing": [
{
"totalAmount": 78.8,
"totalTaxAmount": 40.8,
"baseFareAmount": 38.0
}
],
"totalAmount": 78.8,
"totalDuration": 160,
"referenceNumber": 2,
"type": "RP",
"id": 2
},
"segments": [
{
"date": "2016-08-11",
"className": "Standard (W)",
"code": 70,
"totalAmount": 78.8,
"totalDuration": 160,
"referenceNumber": 2,
"type": "RP",
"duration": 160,
"number": "200"
},
{
"date": "2016-08-11",
"className": "Standard (W)",
"code": 70,
"totalAmount": 78.8,
"totalDuration": 160,
"referenceNumber": 2,
"type": "RP",
"duration": 160,
"number": "100"
}
]
}
],
"resultCount": {
"count1": 1,
"count2": 1
},
"displayCount": 2
}
]
}
>Expected Output:
{
"info": {
"date": "2016-08-11",
"class": "M",
"code": 70,
"pricing": [
{
"totalAmount": 68.8,
"totalTaxAmount": 30.8,
"baseFareAmount": 38.0
}
],
"totalAmount": 68.8,
"totalDuration": 160,
"referenceNumber": 1,
"type": "RP",
"id": 1
},
"segments": [
{
"date": "2016-08-11",
"className": "Standard (W)",
"code": 70,
"totalAmount": 68.8,
"totalDuration": 160,
"referenceNumber": 1,
"type": "RP",
"duration": 160,
"number": "100",
}
]
}
我嘗試使用JSON PATH後處理器,但我正在代替結腸和字符串數據中的=
形式所提取的數據,而無需雙引號。
德米特里·喜..謝謝你的回答。它工作正常....但我無法維持提取的json的順序,是否可以按照我需要維護順序的順序提取1塊信息json(因爲它是)第二個HTTP請求。 ?提前致謝。 – Chaitra