JSON Payload

TIBCO BusinessEvents can deserialize JSON payload to a 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:
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" }
}

Payload Without Wrapping Elements

You can set the payload schema to send the JSON document with no wrapping elements. To exclude the wrapper and the internal attribute elements, set the be.http.json.rootElement.ignore property to true. The default value of the property is false.