Parsing Xml

GregTomkins

Active Member
10.1C

We need to parse blobs of 3rd party JSON (eg: we can't change it) that contains a combination of arrays (temp-tables) and stand-alone elements (variables). For example:

Code:
{
  "recipientExternaldId" : "123ABC5", /* variable */
  "searchResponse" : [ /* temp-table */
   {
      "errorCode"        : "0" /* temp-table field */
    }
]
}

It appears that PARSE-JSON doesn't handle this type of structure (never mind that it's not available in 10.1C), nor does converting to XML and using READ-XML (which _is_ available).

I think Progress fundamentally wants to see only arrays (temp-tables) inside the top-level JSON blob. But I'm wondering if something might be possible using XSD's and READ-XMLSCHEMA? I was hoping perhaps it could be tricked into creating temp-tables for the stand-alone elements. Or something like that.

This must be a very common scenario. Any advice? Short of converting to XML and parsing it with the DOM parser?
 
Last edited:
Top