How to insert Int value from session via EL to Json file instead of String

Hi there,
I have a method which extracts id to session:

    public static HttpRequestActionBuilder postRequest() {
        return createBasicPostRequest()
                .check(status().is(201))
                .check(jsonPath("$.ID").ofInt().exists().saveAs("id"));
    }

And I have a predefined Json file which is used in subsequent request as a ElFileBody :

{
    "ID": "#{id}",
    "NAME": "John"
    "SURNAME": "Doe"
}

I expect my request will look like this :slight_smile:

{
    "ID": 1,
    "NAME": "John"
    "SURNAME": "Doe"
}

but it looks like this:

{
    "ID": "1",
    "NAME": "John"
    "SURNAME": "Doe"
}

It wraps β€œ#{id}” from session as a String, but my API expects it to be an Int. How may I achieve id to be inserted as Int?

Did you try not to surrounding your #{id} in your ElFileBody?

ie:

{
    "ID": #{id},
    "NAME": "John"
    "SURNAME": "Doe"
}
1 Like

Exactly. You’re the one wrapping the value with double quotes to make it a String instead of a number :slight_smile:

1 Like

Thank you guys. I thought that double quotes are required to use EL.
Now it works as expected.