Hi:
I am trying to construct the data structure, output, to receive the json format you see below at the bottom using
DATA-INTO output %DATA(REPLY) %PARSER('YAJLINTO'); and it is not working.
what am I doing wrong here with the data structure?
Thanks
Paul
//Output Response Structure
dcl-ds output QUALIFIED;
dcl-ds result DIM(1);
Import_Result CHAR(10);
Request_Type CHAR(30);
Response CHAR(30);
end-ds;
end-ds;
======================================================
{
"result":[
{
"Import Result":"Success",
"Request Type":"Inbound Order",
"Response":"Open"
}
]
}
Data Structure question in receiving json message using YAJLINTO
-
- Site Admin
- Posts: 872
- Joined: Sun Jul 04, 2021 5:12 am
Re: Data Structure question in receiving json message using YAJLINTO
RPG defaults to expecting the JSON variable names to be in all-lowercase. Since yours contain uppercase, they won't match the RPG variable names... it's a poor default, in my opinion, but... that's what IBM decided to do.
Change your statement to use case=convert (I recommend always using this unless you have a good reason not to) and it should work fine.
Change your statement to use case=convert (I recommend always using this unless you have a good reason not to) and it should work fine.
Code: Select all
DATA-INTO output %DATA(REPLY:'case=convert') %PARSER('YAJLINTO');