RE: External Returned JSON with double array

Jerry Forss <[email protected]>
Newsgroups gmane.comp.lang.as400.rpg
Message-ID <BL1PPF07C40B43A1EC0DC23C1600EF2A0E7C6A0A@BL1PPF07C40B43A.namprd22.prod.outlook.com>
I suppose I could open the json, remove the extra [ ], save it and then use the data-into.
This seems like a silly way to do it but just not figuring out how to define it correctly.

YAJLGEN doesn't seem to know what to do with it either. 

-----Original Message-----
From: RPG400-L <rpg400-l-bounces-+hD5IHI5Xscn3HwCXmMcX9BPR1lH4CV8@public.gmane.org> On Behalf Of Jerry Forss
Sent: Wednesday, December 10, 2025 7:17 AM
To: RPG programming on IBM i <[email protected]>
Subject: External Returned JSON with double array

CAUTION: This email originated from outside of the organization. Do not click links or open attachments unless you recognize the sender and know the content is safe.

One of our carriers has a replacement service that returns a json response.

In the response it has a double array defined and I am having trouble defining it in my rpg.
How do I define this correctly?

Section of returned json.

               "revenueDetails": [
                              [
                                             {
                                                            "name": "D LIFTGATE",
                                                            "description": "DELIVERY LIFTGATE",
                                                            "calc_rate": 55,
                                                            "revenue_amount": 55,
                                                            "freight_class_code": "92.5",
                                                            "id": 26
                                             },
                                             {
                                                            "name": "Minimum B",
                                                            "description": "MINIMUM CHARGE",
                                                            "calc_rate": 97,
                                                            "revenue_amount": 97,
                                                            "freight_class_code": "92.5",
                                                            "id": 170
                                             },
                                             {
                                                            "name": "Fuel Surc",
                                                            "description": "Fuel Surcharge",
                                                            "calc_rate": 0.33,
                                                            "revenue_amount": 32.01,
                                                            "freight_class_code": "92.5",
                                                            "id": 68
                                             }
                              ]
               ],

From yajlgen

num_REVENUEDETAILS int(10) inz(0);
REVENUEDETAILS varchar(1) dim(1); // empty;

From my code

    cnt_revenueDetails            Int(5);
    Dcl-ds revenueDetails         Dim(25);
      name                        Char(50);
      description                 Char(100);
      calc_rate                   Packed(7 : 3);
      revenue_amount              Packed(7 : 2);
      freight_class_code          Char(5);
      id                          Char(5);
    End-Ds;
--
This is the RPG programming on IBM i (RPG400-L) mailing list To post a message email: [email protected] To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request-+hD5IHI5Xscn3HwCXmMcX9BPR1lH4CV8@public.gmane.org
Before posting, please take a moment to review the archives at https://archive.midrange.com/rpg400-l.

Please contact support-FMtJrHiV//lnDLsaKlm4mFaTQe2KTcn/@public.gmane.org for any subscription related questions.

-- 
This is the RPG programming on IBM i (RPG400-L) mailing list
To post a message email: [email protected]
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request-+hD5IHI5Xscn3HwCXmMcX9BPR1lH4CV8@public.gmane.org
Before posting, please take a moment to review the archives
at https://archive.midrange.com/rpg400-l.

Please contact support-FMtJrHiV//lnDLsaKlm4mFaTQe2KTcn/@public.gmane.org for any subscription related questions.
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.