J
Jens Dahlin
Guest
I'm struggling a bit with a JSON produced by Elasticsearch. What I want to do is parse the JSON-string and output some data based on values in the document. First I tried to match a dataset to the structure but I failed. Having worked quite a lot with 3rd party XML I wasn't surprised. So looking at other options I started working with the Progress.JSON collection but I'm not getting anywhere. Since I'm unsused to OOABL I'm unsure if it's me or if functionality is missing. I can't really get any data out of it. This is what I've tried so far: USING Progress.Json.ObjectModel.*. DEFINE VARIABLE lResJSONCode AS LONGCHAR NO-UNDO. DEFINE VARIABLE myParser AS ObjectModelParser NO-UNDO. DEFINE VARIABLE myConstruct AS JsonConstruct NO-UNDO. COPY-LOB FROM FILE "c:\temp\json.json" TO lResJSONCode CONVERT TARGET CODEPAGE "utf-8". myParser = NEW ObjectModelParser( ). myConstruct = myParser
arse(lResJSONCode). /** Now what? **/ /* This doesn't work MESSAGE myConstruct:cluster_name VIEW-AS ALERT-BOX. */ DELETE OBJECT myConstruct. DELETE OBJECT myParser. Doing myConstruct:writeFile("c:\temp\jsonoutput.json") actually creates a file with the right content so I know I at least have something to work with. A J-DOCUMENT like the X-DOCUMENT handle would be nice by the way... Hints?
Continue reading...

Continue reading...