× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



I just did a project like this, although I used YAJL instead.

You need to process the embedded JSON into a variable, and then process
that variable like you just read in "real" JSON. The parser should convert
the slashes, etc like you said.

So, read JSON.
Find the element with embedded JSON with the parser.
Move that into the parser again.

Again, this is using YAJL but I'm guessing it's the same. I'd try making
the DS's separate instead of sub-ds of the main DS.

To me, I think it's sort of silly to have JSON as data. Maybe there is a
reason for it, but I don't see it when it could be a sub-object just as
easily.



On Tue, Apr 13, 2021 at 10:20 AM Jack Prucha <Jack.Prucha@xxxxxxx> wrote:

We're on 7.3 and I have a working program processing JSON transactions.
I'm to start processing some new transactions and am not sure what issues I
might have. The program currently uses Data-Into and YAJLINTO.

The new transactions looks like this:


{"id":396,"payload":"{\"name\":{\"firstName\":\"JAMES\",\"lastName\":\"SHUE\",\"id\":null,\"suffix\":null,\"middleName\":\"B\"},\"dob\":\"1955-01-01\",\"someNumber\":\"123456789\",\"tin\":null,\"workPhone\":null,\"homePhone\":null}","internalAccountNumber":12345,"as400AccountNum":12345678902,"eventType":"DELETE","source":"SUCCESSOR","status":"PENDING","submitDate":"2021-04-08
15:37:03","createdDate":"2021-04-08
15:37:03","createdBy":"unknown","lastModifiedDate":"2021-04-08
15:37:03","lastModifiedBy":"unknown"}

My question is about the "payload" object which is a JSON inside of a JSON.


1. Should this be defined as just a nested array? Something like this:

dcl-ds txSuccessorJSONDoc qualified;
ID VarChar(20) inz('0');

Dcl-ds PAYLOAD;
FIRSTNAME varchar(14) inz('');
MIDDLENAME varchar(13) inz('');
LASTNAME varchar(20) inz('');
SUFFIX varchar(3) inz('');
DOB varchar(10) inz('');
SOMENUMBER varchar(9) inz('');
TIN varchar(9) inz('');
WORKPHONE varchar(10) inz('0');
HOMEPHONE varchar(10) inz('0');
End-Ds;

USERID VarChar(128) inz('0');
INTERNALACCOUNTNUMBER VarChar(9) inz('0');
AS400ACCOUNTNUM VarChar(12) inz('0');
EVENTTYPE varchar(10) inz('');
SOURCE varchar(50) inz('');
STATUS varchar(50) inz('');
SUBMITDATE varchar(25) inz('');
CREATEDDATE varchar(25) inz('');
CREATEDBY varchar(128) inz('');
LASTMODIFIEDDATE varchar(25) inz('');
LASTMODIFIEDBY varchar(128) inz('');
CREATEDDATE varchar(25) inz('');
End-ds;


1. I'm told the embedded slashes in the payload object should be
recognized and ignored by the JSON processor. Do I have to do anything
different for that portion of the JSON to process? I'm not finding much on
this with Google.

TIA
Jack


[CFNC]

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@xxxxxxxxxxxxxxxxxxxx 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 ...

Follow-Ups:
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.