Might be a little easier to read.

{
"documentHistoryEvents":[
{
"type":"Created",
"date":"2019-04-01T20:33:13.485564Z",
"description":"Created by external_web_esig@xxxxxxx",
"participantEmail":"external_web_esig@xxxxxxx",
"actingUserIpAddress":"66.194.20.120"
},
{
"type":"Sent",
"date":"2019-04-01T20:33:15.048387Z",
"description":"Sent<mailto:external_web_esig@xxxxxxx%22,%
22participantEmail%22:%22external_web_esig@xxxxxxx
%22,%22actingUserIpAddress%22:%2266.194.20.120%22%7d,%7b%22type%22:%22Sent%22,%22date%22:%222019-04-01T20:33:15.048387Z%22,%22description%22:%22Sent>
by
external_web_esig@xxxxxxx",
"participantEmail":"external_web_esig@xxxxxxx",
"actingUserIpAddress":"66.194.20.120"
},
{
"type":"Viewed",
"date":"2019-04-01T20:33:40.774774Z",
"description":"Viewed<mailto:external_web_esig@xxxxxxx%22,%
22participantEmail%22:%22external_web_esig@xxxxxxx
%22,%22actingUserIpAddress%22:%2266.194.20.120%22%7d,%7b%22type%22:%22Viewed%22,%22date%22:%222019-04-01T20:33:40.774774Z%22,%22description%22:%22Viewed>
by
test@xxxxxxx",
"participantEmail":"test@xxxxxxx",
"actingUserIpAddress":"66.194.20.120"
}
],
"participants":[
{
"email":"external_web_esig@xxxxxxx",
"name":"Program<mailto:test@xxxxxxx%22,%
22participantEmail%22:%22test@xxxxxxx
%22,%22actingUserIpAddress%22:%2266.194.20.120%22%7d],%22participants%22:[%
7b%22email%22:%22external_web_esig@xxxxxxx
%22,%22name%22:%22Program> Administrator"
},
{
"email":"external_web_esig@xxxxxxx<mailto:external_web_esig@xxxxxxx
",
"name":"Program Administrator"
},
{
"email":"test@xxxxxxx<mailto:test@xxxxxxx>",
"name":"SMILEY ALMENDAREZ"
}
],
"status":"Viewed",
"documentKey":"Lzq8e8o8tmFYi2viZphuHh"
}

On Wed, May 8, 2019 at 10:47 AM Jack Prucha <Jack.Prucha@xxxxxxx> wrote:

Hopefully someone can help me with the various DS definitions and the
necessary parameters on the Data-Into command.

This is my first experience with JSON as the web guy asked if we can read
it or does he have to create another flat file.

This was partially working when I first put together a test pgm using
Scott's YAJL and the various subprocedure calls to process JSON. I got the
Data-Into PTFs installed (7.3), switched the parser to YAJLINTO and now I'm
realizing that my JSON document is complex. There are three JSON "objects"
or data structures in the incoming document. It doesn't matter if I have
to process the document three times or can do it all once.

The document looks like this:

{"documentHistoryEvents":[{"type":"Created","date":"2019-04-01T20:33:13.485564Z","description":"Created
by external_web_esig@xxxxxxx","participantEmail":"
external_web_esig@xxxxxxx
","actingUserIpAddress":"66.194.20.120"},{"type":"Sent","date":"2019-04-01T20:33:15.048387Z","description":"Sent<mailto:
external_web_esig@xxxxxxx%22,%
22participantEmail%22:%22external_web_esig@xxxxxxx%22,%22actingUserIpAddress%22:%2266.194.20.120%22%7d,%7b%22type%22:%22Sent%22,%22date%22:%222019-04-01T20:33:15.048387Z%22,%22description%22:%22Sent>
by external_web_esig@xxxxxxx","participantEmail":"
external_web_esig@xxxxxxx
","actingUserIpAddress":"66.194.20.120"},{"type":"Viewed","date":"2019-04-01T20:33:40.774774Z","description":"Viewed<mailto:
external_web_esig@xxxxxxx%22,%
22participantEmail%22:%22external_web_esig@xxxxxxx%22,%22actingUserIpAddress%22:%2266.194.20.120%22%7d,%7b%22type%22:%22Viewed%22,%22date%22:%222019-04-01T20:33:40.774774Z%22,%22description%22:%22Viewed>
by test@xxxxxxx","participantEmail":
"test@xxxxxxx
","actingUserIpAddress":"66.194.20.120"}],"participants":[{"email":"
external_web_esig@xxxxxxx","name":"Program<mailto:test@xxxxxxx%22,%
22participantEmail%22:%22test@xxxxxxx
%22,%22actingUserIpAddress%22:%2266.194.20.120%22%7d],%22participants%22:[%
7b%22email%22:%22external_web_esig@xxxxxxx%22,%22name%22:%22Program>
Administrator"},{"email":"external_web_esig@xxxxxxx<mailto:
external_web_esig@xxxxxxx>","name":"Program Administrator"},{"email":"
test@xxxxxxx<mailto:test@xxxxxxx>","name":"SMILEY
ALMENDAREZ"}],"status":"Viewed","documentKey":"Lzq8e8o8tmFYi2viZphuHh"}

There's a documentHistoryEvents, participants, and an unnamed object.
It's formatted correctly as I had the web guy show me using one of the
online formatters.

My Data structures and code are defined as follow:

Dcl-ds documentHistoryEvents Dim(100) Qualified;
Type Char(20);
Date Char(28);
Description Char(50);
ParticipantEmail Char(50);
ActingUserIPAddress Char(50);
End-Ds;

Dcl-ds participants Dim(100) Qualified;
EMail Char(50);
name Char(50);
End-Ds;

Dcl-ds DocStatus Qualified;
status Char(20);
documentKey Char(50);
End-Ds;

Dcl-s ResponseStr VarChar(16000000);

// Load JSON Document into DS
Data-Into documentHistoryEvents %Data(ResponseStr:'Case=Any -
Doc=String ')
%Parser('YAJLINTO');

ResponseStr has the JSON loaded from a website using an HTTP call. I've
tried processing just the documentHistoryEvents document using combinations
of path, allowextra and countprefix options, but I keep getting RNX0356
reason code 5 when executing. I understand the layouts of the DS should
match the JSON fields but not sure what to do with multiple documents and
an unnamed document.

TIA
Jack Prucha
Programming Team Supervisor

College Foundation, Inc.
Office Phone: 919.835.2530

This email, including any documents, files, or previous email messages
attached to it, has been sent from an email account of College Foundation
Inc., (CFI) and may contain confidential, proprietary, or legally
privileged information belonging to CFI. If you are not the intended
recipient, any dissemination, distribution, or copying of this email or its
attachments is strictly prohibited. If you have received this email in
error, please immediately notify the sender by email and destroy the
original email and any attachments.
--
This is the RPG programming on IBM i (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives
at https://archive.midrange.com/rpg400-l.

Please contact support@xxxxxxxxxxxx for any subscription related
questions.

Help support midrange.com by shopping at amazon.com with our affiliate
link: https://amazon.midrange.com


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.