Click here to Skip to main content
15,881,089 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a JSON/XML api and want to pass an additional payload as part of the message.

For example JSON:
JavaScript
{
  "SomeId": "0ffa1fc7-4e6e-46a3-a650-2129c32be1e9",
  "Payload": "INSERT JSON HERE"
  "Name": "sample string 3"
}

or for XML:
XML
<Entity>
  <SomeId>0ffa1fc7-4e6e-46a3-a650-2129c32be1e9</SomeId>
  <Name>sample string 2</Name>
  <Payload>INSERT XML HERE</Payload>
</Entity>


The reason is because I want this payload to be persisted and used at a later stage.
Posted
Updated 8-Aug-15 8:54am
v7
Comments
John C Rayan 8-Aug-15 16:40pm    
Need more info. Possibly , you post some code in here. I don't see any problem in what you want to do.
Patrice T 8-Aug-15 20:28pm    
Both are simple text.
What is your problem ? where ?

1 solution

The solution was of course to escape the payload

e.g.

JavaScript
{
  "Id": "fb3c6ce3-04ab-4c0d-84a9-11c4ab4416bc",
  "Payload":"{\"ID\":\"testid1\",\"Value\":10}",
  "Name": "sample string 3"
}
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900