空手道:发送布尔值作为请求中的参数 JSON

karate : Send boolean values as parameters in request JSON

* def updategetPhonePref = !getPhonePref
* def mpRequestJson =
            """
            {
                "entity": '<entity>',
                "consent": {
                    "PHONE": updategetPhonePref
                },
                "notices": [{
                    "title": "policy",
                    "version": "NA"
                }],
                "source": "existing web"
            }
            """
            Given path '<entity>'
            And request mpRequestJson
            When method PUT
            Then status 200
            Examples:
                |entity  |
                |abc     |

我有上述请求JSON,updategetPhonePref 的值为布尔值。如何将它作为参数传递到请求 JSON 参数 "PHONE"?

使用embedded expressions,

"PHONE": "#(updategetPhonePref)"