Jim,

You have to name the num_ field after the array that you want to count for.
So you need a num_items field outside of the items array.

Hth,
-Arco

Op di 19 nov. 2024 18:04 schreef Jim Franz <franz9000@xxxxxxxxx>:

I have data structure set up, and able to execute YAJLINTO, but no values
in DS and no errors.
V7R5

The json is here, have clipped out many other columns to make shorter (and
there may be 1 item or many but in this case json has 1 set of values)
{"items": [ {
"firstName":".",
"lastName":"CESAR GLASS AND CONSTRUCTION",
"email":"CGC78@xxxxxxxxxx",
"shippingAddress":
{
"countryDisplay":null,
"stateDisplay":null,
"line1":null,
"line2":null,
"city":null,
"country":null,
"state":null,
"zip":null
},
"paymentMethods":[],
"createdOn":"2024-11-17T19:08:30.601Z",
"modifiedOn":null,
"id":"97bb28db-a8f5-42a7-929b-b22b013b729d"
}
],
"total":1}

i'm sure my DS not right,( and left out of DS shippingAddress,
paymentMethods, and total as not needed in this pgm).. but perhaps that's
the issue of not defining the complex parts of this json?
I've searched archives, Scott's online docs and posts, but not found a
similar json example.
* define work fields
D xOut S 5000
* define data structure for json results
D items DS qualified dim(99)
D num_list 10i 0
D firstName 50
D lastName 50
D email 100
D id 64

data-into items
%DATA(xOut
: 'case=any allowextra=yes allowmissing=yes countprefix=num_')
%PARSER('YAJLINTO');

degug shows only num_list has a value
ITEMS.NUM_LIST(1) = 1077952576 and same value in all 99 buckets of array

I do have several other YAJLINTO programs working ok with same vendor, but
this is first with an "items" json.

TIA
Jim Franz
--
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.



As an Amazon Associate we earn from qualifying purchases.

This thread ...

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.