Jump to content

Parsing complex JSON data from HTTPRequest in Business Event


Sumit Datta 2

Recommended Posts

Hi,

We areusing Business Event 5.3.

In our application, we arereceiving a HTTP Request with JSON payload through a HTTP Channel. The JSON Payload looks like below:

{

"Customer" :

{

"attributes" : {

"type" : "www.tibco.com/be/ontology/Concepts/Customer"

},

"Address": {

"address_line1" : "201 XYZ Street",

"city" : "PQR"

},

"name": "ABC",

"age": "22"

}

}

We have defined a Concept named "Address" with two properties, namely, "address_line1" and "city". And another Concept named "Customer" with properties "name", "age" and "Address" (with type as Contained Concept). We have also set Receiving Event Payload as "Customer" (XML Element Reference).

What we observe is that when a HTTP request comes with above JSON payload, BE is correctly setting the "name" and "age" properties inside the Customer Concept. But, it is setting "Address" as NULL. Any idea what needs to be done so that such nested Concepts are also set by the XML parser

We have looked at the examples provided with BE - both BEJSONClient and BEJSONServer use only elementary data elements in the JSON payload and do not use complex data elements inside JSON structure.

 

Thanks for your help.

Sumit

Link to comment
Share on other sites

  • 10 months later...

For BE Address is a contained or referenced concept. You have to update the payload and add all elements to root folder or update payload and add child attribute.

eg:

{"Customer":

{"attributes":

{"type":"www.tibco.com/be/ontology/Concepts/Customer"},

"name":"ABC",

"age":22,

"Address":

{"attributes":

{"type":"www.tibco.com/be/ontology/Concepts/Address"},

"address_line1":"201 XYZ Street",

"city":"PQR"

}

}

}

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...