Error Reading JSON using Data-INTO

Kathan Pandya <[email protected]>
Newsgroups gmane.comp.systems.as400.web
Message-ID <CAFuzc_be=f+5AqEihJjrYu8Ej0ECYCT-G9tir85NMPMYO=LqQQ@mail.gmail.com>
Hi,

I am new to YAJL and using DATA-INTO. I have a simple json and I am trying
to read it using DATA-INTO and getting below error:
Cause . . . . . : While parsing a document for the DATA-INTO operation, the
parser found that the document does not correspond to RPG variable "data"
and the options do not allow for this. The reason code is 4. The exact
subfield for which the error was detected is "data.instruction2". The
options are "allowextra=yes". The document name is *N; *N indicates that the
document is not an external file. The parser is 'YAJLINTO'. *N indicates
that the parser is a procedure pointer.

JSON -
{
"data": {
"instruction2": "FIRST SEAT",
"seat1l3": "2356",
"reset34": "Yes",
"temp": "-78",
"seat1l4": "326",
"seat2l3": "3265",
"instruction1": "** Daily Check Call **",
"seat2l4": "986",
"trl": "12345",
"seat2a70": "253",
"seat1a70": "895",
"eta": "2021-08-18T11:23:24-07:00",
"onsched": "Yes",
"hub": "896586",
"odo": "123658",
"reasonoffsched": "traffic"
},
"title": "Daily Check Call - 01"
}


RPG Declaration -

dcl-ds data qualified;
instruction2 char(50);
seat1l3 char(5);
reset34 char(1);
temp char(3);
seat1l4 char(5);
seat2l3 char(5);
instruction1 char(50);
seat2l4 char(5);
trl char(6);
seat2a70 char(5);
seat1a70 char(5);
eta char(26);
onsched char(1);
hub char(7);
odo char(11);
reasonoffsched char(70);
title char(50);
end-ds;

I am moving the data into a standalone character variable name JsonString
(using it below in Data-INTO)

Statement -
Data-into data %Data(JsonString:'allowextra=yes') %PARSER('YAJLINTO');


Please advise what am I doing wrong?
-- 
This is the Web Enabling the IBM i (AS/400 and iSeries) (WEB400) mailing list
To post a message email: [email protected]
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/web400
or email: [email protected]
Before posting, please take a moment to review the archives
at https://archive.midrange.com/web400.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.