One of the annoying things with our native json.serialize routine is that if you have a ‘userdata’ object – i.e. an HL7 or XML node tree inserted into the Lua table, the conversion code will choke and not convert it.
It’s bothered me for a while so as part of the rejig of the Channel Manager I implemented this wrapper function:
It iterates through the tree structure and finds userdata objects that support the nodeValue method and converts them into strings.
It works nicely so far, you can see how it simplifies the code:
Should be handy for anyone who is working on JSON in Iguana.
Here’s another nice example of simpler code:
Hope people find it useful.
You must be logged in to reply to this topic.