Format 1: parsing a JSON string
%JSON PARSE &object INTO &target +
[WITH DETAIL] +
[NAME OF &name is &json_name +
.
.
&name_n is &json_name_n] +
[SUPPRESS &supp_name +
.
.
&supp_name_n] +
[EXIT &exit] +
END-JSON
Where:
- &object
- File name that contains JSON format document.
- &target
- The target group field defined as W/S field. The elementary items within the group must be defined as NATIONAL type (Refer to Program examples). The group field must have the same hierarchy as the JSON Script with field names exactly as found in the JSON Script.
- &name_1..&name_n
- Field names defined in the &target group item to be matched to the field names in the JSON Script.
- &json_name . . is &json_name_n
- Field names in the JSON Script to be correlated to the &name in the &target object.
- &supp_name . . is &supp_name_n
- Field names in the JSON Script to be suppressed (ignored).
- &exit
- User Exit for off-loading JSON result. This must be a PROC in the
Easytrieve Plus program. In the exit, the user must write logic to offload the derived JSON data to
a hard media with DISPLAY or other means. If &exit
is a file, no exit is taken, the data is written to the specified file.
The default is no exit.
CAUTION:Exit is required for JSON Script that contains array.