json pay lode

Not applicable

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 Solved
0 2 90
2 ACCEPTED SOLUTIONS

Hi Jayaprakash L,

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

<Payload contentType="application/json">

\{ "Key": "{variableName}" }

</Payload>

View solution in original post

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

View solution in original post

2 REPLIES 2

Hi Jayaprakash L,

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

<Payload contentType="application/json">

\{ "Key": "{variableName}" }

</Payload>

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