when I pass in this oob data
[{"channelData":{"eventName":"ready", "eventDataInfo":{location:{"path":"web/sales/medicare"}}}}] qwerty
and then call ^jsonParse() followed by ^jsontree() I get
{ # jo-t0
"channelData": { # jo-t1000
"eventName": "ready",
"_"eventDataInfo"": { # jo-t1001
"location": { # jo-t1002
"path": "web/sales/medicare"
}
}
}
}
what I don’t understand is why eventDataInfo looks like it does.
It makes it where channelData.eventDataInfo not work.
I put in some extra logging in the controller like this.
topic: ~swgcontrol system ()
u: START_SENTENCE_PROCESSING ()
^log(\n\n *** start processing sentence: %originalsentence *** \n)
# allow for json formatted oobData, including channelData that will be sent back to
# the calling channel adapter.
u: PARSE_OOB_DATA (\[ _* )
^log( this is the raw oob data: _0)
$$oobInData = ^jsonparse( transient NOFAIL _0)
^log( \n oobInData: ^jsontree($$oobInData) )
and I see:
*** start processing sentence: [ {"channelData":{"eventName":"ready", "eventDataInfo":{location:{"path":"web/sales/medicare"}}}} ] ***
this is the raw oob data: {"channelData":{"eventName":"ready",_"eventDataInfo":{location:{"path":"web/sales/medicare"}}}} ]
incoming channelData: JSON=>
{ # jo-t1000
"eventName": "ready",
"_"eventDataInfo"": { # jo-t1001
"location": { # jo-t1002
"path": "web/sales/medicare"
}
}
}
<=JSON
it seems that the space between the commma after “ready” and before “eventDataInfo” is causeing an underbar to be inserted which in turn is messing up the ^jsonparse()
If I remove the space then I get
*** start processing sentence: [ {"channelData":{"eventName":"ready","eventDataInfo":{location:{"path":"web/sales/medicare"}}}} ] ***
this is the raw oob data: {"channelData":{"eventName":"ready","eventDataInfo":{location:{"path":"web/sales/medicare"}}}} ]
incoming channelData: JSON=>
{ # jo-t1000
"eventName": "ready",
"eventDataInfo": { # jo-t1001
"location": { # jo-t1002
"path": "web/sales/medicare"
}
}
}
<=JSON
and $$oobindata.channelData.eventDataInfo.location.path works just fine!
Conclusion and Note to All
I think the lesson learned is that if you are capturing OOB data via a pattern match, the pattern matcher will insert underbars between json tokens.