# invalid json response

**URL:** <https://community.gatling.io/t/invalid-json-response/6220>\
**Category:** Gatling (Open-Source)\
**Created:** [August 15, 2021, 3:27pm UTC](https://community.gatling.io/t/invalid-json-response/6220 "2021-08-15T15:27:17Z")\
**Posts on this page:** 7\
**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 15, 2021, 3:27pm UTC](https://community.gatling.io/t/invalid-json-response/6220/1 "2021-08-15T15:27:17Z")

</div>

Hi Stephane,

I need to transform response body before extracting jsonpath, as response body is having some special characters.  
here is the **response** :

{“controllerData”:{“MashupRefs”:{“MashupRef”:[{“mashupId”:“isf.shipment-pick.getShipmentDetails”,“Output”:{“Shipment”:{“Status”:{“Status”:“1100.70.06.10”,“Description”:“Ready For Backroom Pick”},“IsOverdue”:“true”,“DeliveryMethod”:“PICK”,“DocumentType”:“0001”,“ImageUrl”:“isf\x **2Fresources\x2Fcss\x2Ficons\x2Fimages\x2FtimeOverdue.png** ”,“OrderNo”:“3100000240”,“Status\_scattr”:“1100.70.06.10”,“DisplayOrderNo”:“3100000240”,“ShipmentNo”:“100000140”,“ShipmentKey”:“202108102030071344685”,“SLACssClass”:“time\_overdue”,“ExpectedShipmentDate”:“2021-08- **10T22\x3A30\x3A08\x2B00\x3A00** ”,“TimeRemaining”:“Delayed by 3 d”,“SellerOrganizationCode”:“BAY”,“ShipNode”:“1101”,“OrderHeaderKey”:“202108102029241344371”,“EnterpriseCode”:“BAY”,“ImageAltText”:“Overdue”}},“mashupRefId”:""},{“mashupId”:“isf.shipment-pick.getAllPickableShipmentLineList”,“Output”:{“ShipmentLines”:{“TotalQuantity”:“1”,“ShipmentLine”:[{“OriginalQuantity”:“1”,“UnitOfMeasure”:“EACH”,“Shipment”:[{“Currency”:“CAD”,“EnterpriseCode”:“BAY”}],“DocumentType”:“0001”,“ImageURL”:“https\x3A\x2F\[x2Fs7d9.scene7.com](http://x2Fs7d9.scene7.com)\x2Fis\x2Fimage\x2FTheBay\x2F\x2F0703113596452\_main”,“Quantity”:“1”,“OrderNo”:“3100000240”,“Extn”:{“ExtnIsInternational”:“N”},“ItemID”:“90407099”,“ShipmentKey”:“202108102030071344685”,“ShipmentTagSerials”:{},“ShipmentLineKey”:“202108102030071344684”,“ShortageQty”:“0”,“ShipmentSubLineNo”:“0”,“OrderLine”:{“ItemDetails”:{“DisplayUnitOfMeasure”:“Each”,“UnitOfMeasure”:“EACH”,“AttributeList”:{“Attribute”:[{“Value”:“BLACK”,“Name”:“Color”},{“Value”:“One Size”,“Name”:“Size”}]},“Extn”:{“ExtnDivision”:“KITCHEN”,“ExtnVendorStyle”:“059645”,“ExtnClass”:“010”,“ExtnJewelryFlag”:“N”,“ExtnDepartment”:“636”,“ExtnDepartmentName”:“HOME”},“UOMDisplayFormat”:“formattedQty”,“ItemID”:“90407099”,“ClassificationCodes”:{“Model”:“0600090407099”},“InventoryParameters”:{“IsSerialTracked”:“N”},“AdditionalAttributeList”:{“AdditionalAttribute”:[{“Value”:“BLACK”,“Name”:“Color”},{“Value”:“One Size”,“Name”:“Size”}]},“ItemGroupCode”:“PROD”,“ItemAliasList”:{“ItemAlias”:[{“AliasValue”:“703113596452”,“AliasName”:“ACTIVE\_UPC”}]},“Variation”:“BLACK \x7C One Size”,“PrimaryInformation”:{“Description”:“Dept NameHOME Class desc COUNTERTOP BLENDERS Brand Vitamix VITA-MIX,CORP. 059645 VITAMIX 6500 - BLACK”,“ManufacturerName”:“Vitamix”,“ImageID”:“0703113596452\_main”,“ExtendedDisplayDescription”:“6500 Blender \x2890407099\x29”,“ImageLocation”:“https\x3A\x2F\[x2Fs7d9.scene7.com](http://x2Fs7d9.scene7.com)\x2Fis\x2Fimage\x2FTheBay\x2F”}},“CarrierServiceCode”:"",“ItemGroupCode”:“PROD”,“IsBundleParent”:“N”},“OrderHeaderKey”:“202108102029241344371”,“ProductClass”:"",“Variation”:“BLACK \x7C One Size”,“ShipmentLineNo”:“1”,“BackroomPickedQuantity”:"",“OrderLineKey”:“202108102029241344372”}],“TotalNumberOfRecords”:“1”}},“mashupRefId”:""}]}}}

**Request** :

.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(jsonPath("$.controllerData.MashupRefs.MashupRef[0].Output.Page.Output.Shipments.Shipment[0].ShipmentKey").find.saveAs(“ShipmentKey”)))  
// .check(jsonPath("$").saveAs(“req11”)))

Thanks  
Trisha

---

<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 15, 2021, 6:50pm UTC](https://community.gatling.io/t/invalid-json-response/6220/2 "2021-08-15T18:50:33Z")

</div>

Are you using the latest 3.6.1 Gatling version?

---

<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 16, 2021, 2:52am UTC](https://community.gatling.io/t/invalid-json-response/6220/3 "2021-08-16T02:52:47Z")

</div>

Hi Stephane,

I am using 3.5.1 version

---

<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 16, 2021, 5:18am UTC](https://community.gatling.io/t/invalid-json-response/6220/4 "2021-08-16T05:18:43Z")

</div>

Your response JSON payload is clearly malformed.

Strings such as **isf\x2Fresources\x2Fcss\x2Ficons\x2Fimages\x2FtimeOverdue.png** are obviously encoded in hex format but \ is the JSON escape character, so it should be escaped for JSON =\> **isf\x2Fresources\x2Fcss\x2Ficons\x2Fimages\x2FtimeOverdue.png**

Then, the correct way would be to NOT encode into hex and only use the correct JSON escaping so you would simply write **isf/resources/css/icons/images/timeOverdue.png**.

Instead of trying to work around this application issue downstream, why not report it to the application developers so that they actually fix it on their side?

---

<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 16, 2021, 6:10am UTC](https://community.gatling.io/t/invalid-json-response/6220/5 "2021-08-16T06:10:49Z")

</div>

Hi Stephane,

Is there any workaround for now ? because we are very near to the delivery date.

PLease provide solution, i am really having a hard time with this

---

<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 16, 2021, 6:21am UTC](https://community.gatling.io/t/invalid-json-response/6220/6 "2021-08-16T06:21:22Z")

</div>

[https://gatling.io/docs/gatling/reference/current/http/request/#response-transformers](https://gatling.io/docs/gatling/reference/current/http/request/#response-transformers)

---

<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 16, 2021, 10:04am UTC](https://community.gatling.io/t/invalid-json-response/6220/7 "2021-08-16T10:04:28Z")

</div>

Thanks Stephane,

But it is still not working for me, please can you point what mistake i am doing. Here is the code

 ![Screenshot 2021-08-16 at 3.26.59 PM.png](https://europe1.discourse-cdn.com/flex013/uploads/gatling2/original/1X/d6a7219eee41626611b6b085019a4cab5286aeca.png)

 ![Screenshot 2021-08-16 at 3.27.38 PM.png](https://europe1.discourse-cdn.com/flex013/uploads/gatling2/original/1X/eec9ea3d627ca444a762f10365be9154c0b2f7d1.png)
