gatling + how to send post with json payload?

hi all,

I am looking for inputs on sending POST http request with json as a request payload. if anyone has come across this use case or worked already, please do share the sample script.


I have been trying the below (captured from the online sources), but it end up in error.

400 Bad Request

Bad Request

Your browser sent a request that this server could not understand.

Apache Server at Port 443

Pretty sure you’re confusing a simple body and multipart (what you currently do).

I would like to post a http request with json request body fed in.

thanks for the video link and I went through and tried below. end result is same. I am pretty sure, not doing the right thing here. any help would be highly appreciated.


Missing Content-Type request header maybe?

exactly, thanks a lot for your quick response and help! much appreciated.

quick question:

is there any example that I can refer to pass the json file at run time through json feeder and not hard code it in the main script?


Hey Vijay,

you can try this:


and in the body directory you will have your json payload:


  "firstName": "George",
  "displayName": "_george_",
  "userDescription": "performance engineer"

and you can randomize these fields with a random feeder


To add to my previous post you can randomize your json and use as a body as follows:


great, precisely what I was looking for. will give it a try and get back.

thank you GeorgeK!

BTW, the bodies directory should be in the resources directory. By default Gatling looks in resources dir to find the these types of files.

I hope it works out for you!


thanks a lot George, it worked! appreciate your help in this regard.

I’m glad i could help!!

Glad I could help Vijay!

I do have a same scenario of sending json requests from resources to my scala file.One issue is,does it work with https requests also?.Help me on sending json data fles to a HTTPS requests.