-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathExercico04.p
56 lines (25 loc) · 1.04 KB
/
Exercico04.p
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
USING PROGRESS.json.*.
USING PROGRESS.json.ObjectModel.*.
DEFINE VARIABLE cSourceType AS CHARACTER NO-UNDO.
DEFINE VARIABLE cReadMode AS CHARACTER NO-UNDO.
DEFINE VARIABLE cFile AS CHARACTER NO-UNDO.
DEFINE VARIABLE lRetOK AS LOGICAL NO-UNDO.
DEF TEMP-TABLE ttdados SERIALIZE-NAME 'dados'
FIELD id AS INTEGER
FIELD nome AS CHAR
FIELD telefone AS CHAR.
DEF VAR jArray AS JsonArray NO-UNDO.
DEF VAR jObj AS JsonObject NO-UNDO.
DEFINE VARIABLE lJson AS LONGCHAR NO-UNDO.
ASSIGN cSourceType = 'file'
cFile = 'D:\Jornada-PO-UI\agenda.json'
cReadMode = 'empty' .
lRetOK = TEMP-TABLE ttdados:READ-JSON(cSourceType, cFile, cReadMode ).
jObj = NEW JsonObject().
jObj:READ(TEMP-TABLE ttdados:HANDLE).
EMPTY TEMP-TABLE ttdados.
lJson = string(jObj:getJsonText()) .
TEMP-TABLE ttdados:READ-JSON('longchar', lJson ) .
FOR EACH ttdados:
DISPL ttdados.
END.