Session API and Expression Language for Boolean values at json file

Hello,
For simulation I have a JSON file as a feeder. One of the fields is containing a boolean value. I would like to know how this boolean value can be used as an Expression Language in other JSON files which are contains a request’s payload template
It should be parsed like a boolean, not a String representation

My Feeder file:

[
  {
    "field1": "some_String",
    "field2": "some_String",
    "field3": "some_String",
    "myBoolean": true
  }
]

Example of JSON with payload template:

{
  "array": [
    {
      "field1": "#{someStringSessionKey}",
      "nestedArray": [
        "String_1",
        "String_2"
      ],
      "myBoolean": false 
    }
  ]
}

How value false can be replaced by EL? Just using #{booleanKey}, or it should be inside quotas? Any suggestions? Don’t found such case at documentation

When I replace boolean value with #{booleanKey} IDE found that, there is wrong format of JSON file.
When I use “#{booleanKey}” the String representation will be used for request:

{
  "array": [
    {
      "field1": "#{someStringSessionKey}",
      "nestedArray": [
        "String_1",
        "String_2"
      ],
      "myBoolean": "false" 
    }
  ]
}

BR
Mateusz

When I use “#{booleanKey}” the String representation will be used for request:

Obviously, as you’re wrapping with double quotes :slight_smile:

wrong:

"myBoolean": "#{booleanKey}" 

right:

 "myBoolean": #{booleanKey}

I will test it :slight_smile:
I thought that it will be not working when the IDE was yelling at me due to broken JSON format

UPDATE
Works perfect.

Thanks!

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.