Search code examples
messagebroker

JSON to String Conversion -ESQL-IIB


I have a requirement of building a json message and convert it into a string and pass it as a field value in json. So,as part of it,I created JSON OutputRoot message and i am trying to convert the message as string and set it in OutputRoot.JSON.Data.payload = string(the message that i converted to string earlier). Any suggestion please


Solution

  • You can do this by using the ASBITSTREAM function on the message tree where you built your first JSON message and then using CAST to convert the resulting BLOB to CHARACTER.

    https://www.ibm.com/support/knowledgecenter/SSMKHH_10.0.0/com.ibm.etools.mft.doc/ak05510_.htm

    https://www.ibm.com/support/knowledgecenter/SSMKHH_10.0.0/com.ibm.etools.mft.doc/ak05610_.htm