Don,
I took your example below and ran it through YAJLGEN
// FIXME:
// - The field lengths (varchar/packed) are guesses
// and should be adjusted based on your business rules.
// - The array lengths (dim keywords) are also guesses
// and should be adjusted based on your business rules
dcl-proc readTheJson;
dcl-ds jsonDoc qualified;
num_ERROR_DETAILS int(10) inz(0);
ERROR_DETAILS varchar(1) dim(1); // empty;
num_ERRORED_BOOKING_NUMBERS int(10) inz(0);
ERRORED_BOOKING_NUMBERS varchar(8) inz('') dim(1);
num_IGNORED_BOOKING_NUMBERS int(10) inz(0);
IGNORED_BOOKING_NUMBERS varchar(1) dim(1); // empty;
num_SAVED_BOOKING_NUMBERS int(10) inz(0);
SAVED_BOOKING_NUMBERS varchar(8) inz('') dim(4);
dcl-ds SUMMARY;
ERROR packed(1) inz(0);
IGNORED_DUPLICATE packed(1) inz(0);
SAVED packed(1) inz(0);
end-ds;
end-ds;
dcl-s ifsPathName varchar(5000);
ifsPathName = '/apis/amazonsp/072/error.json';
data-into jsonDoc %DATA( ifsPathname
: 'doc=file case=convert countprefix=num_')
%PARSER( 'YAJLINTO'
: '{ "document_name": "jsonDoc", +
"number_prefix": "YAJL_" }');
end-proc;
-----Original Message-----
From: RPG400-L <rpg400-l-bounces@xxxxxxxxxxxxxxxxxx> On Behalf Of Don Brown via RPG400-L
Sent: Wednesday, October 8, 2025 6:04 PM
To: 'RPG programming on IBM i' <rpg400-l@xxxxxxxxxxxxxxxxxx>
Cc: Don Brown <dbrown@xxxxxxxxxxxxxxxx>
Subject: [EXTERNAL] Data-INTO with double array fails but is valid JSON
<Reposted to the RPG List>
Hi
I am sure I have seen someone else with this error but searching the archives has not found the incident.
The JSON has a double [[ ]] indicating two arrays. If I remove one set (leaving [ ] ) it processes correctly with the data structure below.
So, we have an unnamed array inside an array, how do we build the data structure for that ?
We have this JSON
{"error_details":[
["34515897: meter_off_time 2025-10-06 01:57:06+00:00 is equal to or before meter_on_time '2025-10-06 02:45:04+00:00'"] ], "errored_booking_numbers":["34515897"],
"ignored_booking_numbers":[],
"saved_booking_numbers":["34527032","34526927","34526855","34521442"],
"summary":{"error":1,"ignored_duplicate":0,"saved":4}}
I have checked and the JSON is valid.
This is the data structure.
We did originally have the "error_detail" in the structure but had the same problem and removed thinking it may work.
dcl-ds SATSSData_rUploadData qualified template inz;
dcl-ds rData likeds(DKT_GeneralReturnData);
dcl-ds summary;
saved zoned(5) inz(*zeros);
ignored zoned(5) inz(*zeros);
ignored_duplicate zoned(5) inz(*zeros);
error zoned(5) inz(*zeros);
end-ds summary;
count_saved_booking_numbers zoned(5) inz(*zeros);
saved_booking_numbers varchar(20) inz('')
dim(C_SATSS_MAXDATA);
count_ignored_booking_numbers zoned(5) inz(*zeros);
ignored_booking_numbers varchar(20) inz('')
dim(C_SATSS_MAXDATA);
count_errored_booking_numbers zoned(5) inz(*zeros);
errored_booking_numbers varchar(20) inz('')
dim(C_SATSS_MAXDATA); end-ds;
RPG Code
d rtnData DS likeds(SATSSData_rUploadData)
MONITOR;
Data-into rtnData %Data( %trim(rData.File) :
'doc=file case=convert allowmissing=yes allowextra=yes +
countprefix=count_ trim=all')
%Parser( 'YAJLINTO' );
on-error;
wrkMessage = 'Fail to Convert ' + %trim(rData.File);
UpdateLog(wrkMessage);
exsr Return;
endmon;
Error Message
Data-Into Error message:
Message ID . . . . . . : RNX0356
Date sent . . . . . . : 08/10/25 Time sent . . . . . . : 14:33:00
Message . . . . : The document for the DATA-INTO operation does not match
the RPG variable; reason code 5.
Cause . . . . . : While parsing a document for the DATA-INTO operation, the
parser found that the document does not correspond to RPG variable "rtndata"
and the options do not allow for this. The reason code is 5. The exact
subfield for which the error was detected is "rtndata". The options are
"doc=file case=convert allowmissing=yes allowextra=yes countprefix=count_
trim=all". The document name is
/HOME/SATSS/DOWNLOAD/AIT_20251008_001644918_SATSS_UPLOADDATA.json; *N
indicates that the document is not an external file. The parser is
'YAJLINTO'. *N indicates that the parser is a procedure pointer.
Recovery . . . : Contact the person responsible for program maintenance to
determine the cause of the problem.
Technical description . . . . . . . . : Reason codes and their meanings are
as follows:
1. The specified path to the name was not found in the document.
2. The document contains too few array elements for array subfields of a
data structure.
3. The document contains too many array elements for array subfields of a
data structure.
4. The document is missing information to match subfields.
5. The document contains extra names that do not match subfields.
6. The document contains text content within the content for the subfields
of a data structure.
7. The document contains subfield items for RPG scalar fields, subfields or
Any assistance appreciated.
Thanks
Don
Brisbane - Sydney - Melbourne
Don Brown
Senior Consultant
P: 1300 088 400
DISCLAIMER. Before opening any attachments, check them for viruses and defects. This email and its attachments may contain confidential information. If you are not the intended recipient, please do not read, distribute or copy this email or its attachments but notify sender and delete it. Any views expressed in this email are those of the individual sender
--
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://protect.checkpoint.com/v2/r01/___https://lists.midrange.com/rfnqrfsdqnxynsktdwul955-q___.YzJ1OnRvdGFsYml6ZnVsZmlsbG1lbnQxOmM6bzphMzdlYzEwZDVjZDUyNzcxZTA4MjM3OTJkOTdlNjcwYTo3OmI5OTM6MTEzNTNiYjBjZjc4ODg0YmE4ZjRhZTlmMDVhZjY3MzBiZDlhMmU3MmI5MDQ4N2RmMmExZWMyMDg4MjQ0NjVjZDpwOlQ6VA
or email: RPG400-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives
at
https://protect.checkpoint.com/v2/r01/___https://archive.midrange.com/wul955-q___.YzJ1OnRvdGFsYml6ZnVsZmlsbG1lbnQxOmM6bzphMzdlYzEwZDVjZDUyNzcxZTA4MjM3OTJkOTdlNjcwYTo3OmI1YWM6M2YyZTg3YzZhYzNlYTFjOTZkMTZhZTc3N2QwMzM0OGU5NDA5ZWM1YmI0ZjhhZWM3YWM4ZjFhNDk3MmMxOWY2YTpwOlQ6VA.
Please contact support@xxxxxxxxxxxxxxxxxxxx for any subscription related questions.
[CAUTION! This email originated outside of the organization. Please do not open attachments or click links from an unknown or suspicious origin.]
Greg Wilburn
Director of IT
301.895.3792 ext. 1231
As an Amazon Associate we earn from qualifying purchases.