[Progress Communities] [Progress OpenEdge ABL] Forum Post: RE: READ-JSON

  • Thread starter Thread starter goo
  • Start date Start date
Status
Not open for further replies.
G

goo

Guest
Try this…. Then you will understand how to do it… myFile.json { "version": "3.1.0", "sync-datetime": "2019-11-06 09:23:48", "message": "", "messages": [], "error": false, "invoices": [ { "id_customer": "26518", "id_ow": "97", "nr_customer": "C101", "company": "Cliente 2", "rows": [ { "id_invoice_details": "24399", "id_invoice": "12859", "description": "Riga libera", "total": 20 }, { "id_invoice_details": "24391", "id_invoice": "12859", "description": "Riga libera", "total": 20 }] }] } Def var myJsonContent as longchar no-undo . Def var oParser as Progress.Json.ObjectModel.ObjectModelParser. Def var oObject as Progress.Json.ObjectModel.JsonObject. Def var oArray as Progress.Json.ObjectModel.JsonArray. Def var oInvoices as Progress.Json.ObjectModel.JsonArray. Def var oRows as Progress.Json.ObjectModel.JsonArray. def var ii as int no-undo . fix-codepage (myJsonContent) = 'UTF-8' . Copy-lob from file 'e:/temp/slettes2.json' to object myJsonContent. oParser = new Progress.Json.ObjectModel.ObjectModelParser(). oObject = cast (oParser:Parse(myJsonContent),Progress.Json.ObjectModel.JsonObject). oInvoices = oObject:GetJsonArray( 'invoices' ). do ii = 1 to oInvoices: Length : MESSAGE string (oInvoices:GetJsonObject(ii):GetJsonText()) VIEW-AS ALERT-BOX . end .

Continue reading...
 
Status
Not open for further replies.
Back
Top