How can I return a JSON inside an AssigMessage.
I write it as:<payload>
{"json":"json"}
</payload>
here { is interpreted as a variable .how can I proceed if I want to include a variable in the body
Solved! Go to Solution.
Hi Jayaprakash L,
You can do it as just escape as follows for the first curly brace:
<Payload contentType="application/json">
\{ "Key": "{variableName}" }
</Payload>
, Use the below assign message policy:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <AssignMessage async="false" continueOnError="true" enabled="true" name="Assign-Comments"> <DisplayName>Assign Comments</DisplayName> <FaultRules/> <Properties/> <Set> <Payload contentType="application/json" variableSuffix="#" variablePrefix="@"> { "key1" :"@value1#", "key2" :"@value2#", "key3" :"@value3#"
} </Payload> </Set> <IgnoreUnresolvedVariables>true</IgnoreUnresolvedVariables> <AssignTo createNew="false" transport="http" type="request"/> </AssignMessage>
Hi Jayaprakash L,
You can do it as just escape as follows for the first curly brace:
<Payload contentType="application/json">
\{ "Key": "{variableName}" }
</Payload>
, Use the below assign message policy:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <AssignMessage async="false" continueOnError="true" enabled="true" name="Assign-Comments"> <DisplayName>Assign Comments</DisplayName> <FaultRules/> <Properties/> <Set> <Payload contentType="application/json" variableSuffix="#" variablePrefix="@"> { "key1" :"@value1#", "key2" :"@value2#", "key3" :"@value3#"
} </Payload> </Set> <IgnoreUnresolvedVariables>true</IgnoreUnresolvedVariables> <AssignTo createNew="false" transport="http" type="request"/> </AssignMessage>
User | Count |
---|---|
5 | |
2 | |
2 | |
1 | |
1 |