J
jmls
Guest
we use json like this : written in the gmail IDE
USING Progress.Json.ObjectModel.*. DEFINE VARIABLE lResJSONCode AS LONGCHAR NO-UNDO. DEFINE VARIABLE myParser AS ObjectModelParser NO-UNDO. DEFINE VARIABLE myObject AS JsonObject NO-UNDO. COPY-LOB FROM FILE "c:\temp\json.json" TO lResJSONCode CONVERT TARGET CODEPAGE "utf-8". myParser = NEW ObjectModelParser( ). myObject = myParser
arse(lResJSONCode). MESSAGE myObject:GetCharacter("cluster_name") VIEW-AS ALERT-BOX. DELETE OBJECT myObject . DELETE OBJECT myParser. On 21 February 2014 11:46, Jens Dahlin wrote: Working with JSON Thread created by Jens Dahlin 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? Stop receiving emails on this subject. Flag this post as spam/abuse. -- Julian Lyndon-Smith IT Director, dot.r http://www.dotr.com "The bitterness of poor quality remains long after the sweetness of low price is forgotten" Follow dot.r on http://twitter.com/DotRlimited
Continue reading...



Continue reading...