A small challenge for you - enhancing Interoperability message trace for mixed JSON and XML content
Hello community!
I have a small challenge for you :)
One of customers is sending quite a lot of messages between interoperability components, which mix standard request content and streams representing serialized JSON objects. As these JSON streams can be quite long (but not too long, just couple hundreds of characters) they would appreciate if the JSON content of stream was displayed in a nice-to-read way, using syntax highlighting by message trace view.
This picture illustrates the challenge - we are talking about the text framed by a red rectangle:
I'd love to hear from anyone that you were able to come with some solution and post it to open exchange portal!
Dan
Comments
Hi,
Here is the sample code
Set DCJson= {"name":"Janko","surname":"Hrasko","colors":["blue","green","yellow"]}
Set formatter=##class(%JSON.Formatter).%New()
Set sc=formatter.FormatToString(DCJson,.tJsonStr)
Set newMsg = ##class(Ens.StreamContainer).%New()
Set newMsg.Stream = ##class(%Stream.GlobalCharacter).%New()
do newMsg.Stream.Write(tJsonStr)
W newMsg.Stream.Read()
Output:
{
"name":"Janko",
"surname":"Hrasko",
"colors":[
"blue",
"green",
"yellow"
]
}
Thanks,
Wish it was so easy. Unfortunately, my challenge is different - DO NOT MODIFY incoming messages but rather create a custom message display handler class. I believe that with some tweaking of standard display handler class and using some advancexd CSS styles, it could be doable.
Hi @Daniel Kutac ! Have you tried this OEX app by @Guillaume Rongier ?
Hi @Evgeny Shvarov, yes, I had a look at thie project earlier, but my understanding was that it only worked for pure JSON messages and not one that mix classic content with JSON.