I had a query regarding fetching a part of json response obtained from 1st request in jmeter to form a new HTTP request.
I wanted to extract 1 block of info json (as it is) with doubles quotes and colon as a part of 2nd HTTP request.
{
"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",
}
]
}
I tried using JSON PATH POST Processor, but I was getting the extracted data in the form of =
in place of colon and string data without double quotes.