JSON Payload
TIBCO BusinessEvents can deserialize JSON payload to an event and can serialize an event to JSON.
For processing the JSON payload, you must perform these tasks; otherwise, the payload is treated as XML:
- Select the Is JSON Payload while creating a new destination. See Adding Destination to a Channel and Destination Resource Reference.
- The event mapped to the destination, should have the destination URL in its default destination field.
Note:
- Regular payload validation rules apply as they would for default XML-based events, that is, if the namespace check fails, the payload is not set. Namespace for an XML element is part of its root element, while for JSON it is part of "attributes" node under "type".
- After a JSON payload is deserialized to an event, it is used the way an XML-based event is used.
XML and JSON Payload Examples
- XML Request
-
<root xmlns="www.tibco.com/be/ontology/Events/Event2"> <param1>testProp</param1> <param2>123</param2> <param3>true</param3> </root>
- JSON Request
-
{"root" : { "attributes" : { "type" : "www.tibco.com/be/ontology/Events/Event2" } , "param1" : "testProp", "param2" : "123", "param3" : "true" } }
- XML Response
-
<Address> <street>243 Buena Vista Avenue</street> <city>Sunnyvale</city> <zip>94086</zip> </Address>
- JSON Response
-
{"Address" : { "street" : "243 Buena Vista Avenue", "city" : "Sunnyvale", "zip" : "94086" } }
Copyright © Cloud Software Group, Inc. All rights reserved.