# json corelation

**URL:** <https://community.gatling.io/t/json-corelation/6222>\
**Category:** Gatling (Open-Source)\
**Created:** [August 17, 2021, 5:07pm UTC](https://community.gatling.io/t/json-corelation/6222 "2021-08-17T17:07:32Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![trisha\_agarwal](https://avatars.discourse-cdn.com/v4/letter/t/bc8723/32.png) [@trisha\_agarwal](https://community.gatling.io/u/trisha_agarwal)\
**Post date:** [August 17, 2021, 5:07pm UTC](https://community.gatling.io/t/json-corelation/6222/1 "2021-08-17T17:07:32Z")

</div>

Hi Stephane,  
I have captured json response and had perform a replace function on that response.  
I need to convert that response to json again so that i can use json path extractor for my corelation.

PLease help me with the code  
Here is my code:

.exec(http(“request\_24”)  
.post("/isf/store/mashupController.do")  
.headers(headers\_24)  
.formParam(“scControllerData”, “”"{“MashupRefs”:{“MashupRef”:[{“mashupId”:“extn.isf.shipment-pick.pick-order-list.getSFSPickOrderList”,“Input”:{“Shipment”:{“ComplexQuery”:{“And”:{“Or”:[{“Exp”:[{“Name”:“Status”,“QryType”:“EQ”,“Value”:“1100.70.06.10”}]},{“Exp”:[{“Name”:“DocumentType”,“QryType”:“FLIKE”,“Value”:“0001”},{“Name”:“DocumentType”,“QryType”:“FLIKE”,“Value”:“0006”}]}]}},“DeliveryMethod”:“PICK”,“OrderBy”:{“Attribute”:{“Desc”:“N”}}}},“isPaginated”:“true”,“scPageSize”:“10”,“scPageNumber”:“1”,“scPaginationStrategy”:“NEXTPAGE”}],“isMultiAPICall”:false}}""")  
.formParam(“scCSRFToken”, “${scCSRFToken}”)  
.formParam(“scFlag”, “Y”)  
.check(bodyString.saveAs(“Auth\_Response”)))

.exec(session =\> {  
// put body response into variable  
val res = session(“Auth\_Response”).toString  
// use replace method to modify your json (which is right now a string)  
val newResponse = res.replace("\x", “”)

session.set(“Auth\_Response”, newResponse)  
//.check(jsonPath("$.controllerData.MashupRefs.MashupRef[0].Output.Page.Output.Shipments.Shipment[0].ShipmentKey").find.saveAs(“ShipmentKey”))

}  
)

---

<div class="post-metadata">

**Author:** ![slandelle](https://dub1.discourse-cdn.com/flex013/user_avatar/community.gatling.io/slandelle/32/4_2.png) [@slandelle](https://community.gatling.io/u/slandelle)\
**Post date:** [August 17, 2021, 8:11pm UTC](https://community.gatling.io/t/json-corelation/6222/2 "2021-08-17T20:11:43Z")

</div>

Try to use `responseTransform` instead to patch the response body: [https://gatling.io/docs/gatling/reference/current/http/request/#response-transformers](https://gatling.io/docs/gatling/reference/current/http/request/#response-transformers)

Or better, as I suggested, report this issue to the API developers so they fix it upstream, as this payload is clearly not valid JSON.
