× 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.



Scott,

Yes... I see exactly what you're saying.
But I can't have a field named "@odata.context" and "value" seems like an "envelope" around all of the data. There is another "@odata.next" at the end of value object. The actual structure for each individual order object doesn't seem to have a "name".

My data-into statement is:

Data-Into Orders %data('/gwilburn/orders_test.json':OPTIONS) %parser('YAJLINTO');

I've experimented with different options:
dcl-c OPTIONS const('doc=file case=any allowextra=yes countprefix=count_');

dcl-c OPTIONS const('doc=file case=any allowextra=yes countprefix=count_' path=value); **Adding the "path=value" to the options produces a different "path error".

dcl-c OPTIONS const('doc=file case=any allowextra=yes allowmissing=yes'); ** THIS ONE doesn't produce any meaningful outcome.

I've also tried:
Placing my Orders DS inside another DS named value.

When I view this in notepad++ or Firefox, the "order" array does not have a name - only a number.

This seems way more complicated than XML.

Should I just do this w/out Data-Into??

-----Original Message-----
From: RPG400-L [mailto:rpg400-l-bounces@xxxxxxxxxxxxxxxxxx] On Behalf Of Scott Klement
Sent: Friday, June 07, 2019 4:51 PM
To: rpg400-l@xxxxxxxxxxxxxxxxxx
Subject: Re: Help Data-Into (YAJLINTO) RPG Variable error

Hi Greg,

The RPG data structure and the JSON data need to match.  Right now, they aren't even close (unless you're doing something like parsing only part of it?  You didn't provide the code that shows the data-into statement.)

Your RPG has a DS named 'Orders' that contains subfields 'ID', 'ProfileID', etc.  Your JSON is a DS that contains "@odata.context", and "value".    See what I mean?

-SK


On 6/7/2019 3:19 PM, Greg Wilburn wrote:
I would really rather use the YAJLINTO parse to handle this ChannelAdvisor JSON document. But I can't seem to get to work.

Error is "Data-Into operation does not match RPG variable".

This is an excerpt of the JSON data:

{
"@odata.context": "https://api.channeladvisor.com/v1/$metadata#Orders";,
"value": [
{
"ID": 602044,
"ProfileID": 12019036,
"SiteID": 640,
"SiteName": "Amazon Seller Central - US",
"SiteAccountID": 2787,
"SiteOrderID": "114-7153639-6646652", ... <stuff here>...

},

{

"ID": 602123,

"ProfileID": 12019036,

"SiteID": 640,

"SiteName": "Amazon Seller Central - US",

"SiteAccountID": 2787,

"SiteOrderID": "111-4754461-5234604", ... <stuff here>...

}

],

"@odata.nextLink": "https://api.channeladvisor.com/v1/Orders?access_token=REMOVED&$expand=Items%2CFulfillments&exported=false&$skip=20";

}

Here is my latest attempt at getting the data structure right (you can see some of my other attempts "commented'):

dcl-c OPTIONS const('doc=file case=any allowextra=yes
allowmissing=yes path=value');

// dcl-ds json qualified;
// dcl-ds value qualified;
// count_Orders
dcl-ds Orders qualified dim(20);
ID char(10);
ProfileID char(10);
SiteID char(15);
SiteName char(50);
SiteAccountID char(10);
SiteOrderID char(128);
...<more stuff>...
end-ds orders;

Any help would be appreciated.

Thx
--
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 ...

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.