json pay lode

How can I return a JSON inside an AssigMessage.

I write it as:

{“json”:“json”}

here { is interpreted as a variable .how can I proceed if I want to include a variable in the body

Hi Jayaprakash L,

You can do it as just escape as follows for the first curly brace:

{ “Key”: “{variableName}” }

1 Like

@Jayaprakash L

, 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>