Need help getting a random string at runtime

Hi, I’m trying to load test a service by sending some json data.

I have the json body data in a file, all I need to figure out is how to substitute a random guid value in the json data and also put it in the request path. So for each user session, I need to generate a random guid and do the substitution when I make the POST. I viewed the documentation on the Session API but I still can’t get any data from the session object (I guess I’m not setting it up correctly).

I’m most confused about where to initialize the Session data. Does it need to be a step in the scenario? Or is it defined outside the scenario? I’ve tried both but no luck. Here is the gist of what I have right now:

object Post {
  val postItem = exec(http("postItem")
                 .header("Content-Type", "application/json")

val scn = scenario("Post Item")
.exec(session => {
  val session : Session = ???
  session.set("guid", randomUUID().toString)

Also, in the json file, I substituted for the guid like so:

Ty just this:
exec {session =>
session.set(“guid”, randomUUID().toString)

It should create new copy of your session with all already existing attributes and a new one added.