Pretty weird layout, especially if one wants to ease downstream parsers.As far as I know there isn't some direct and idiomatic array of array native construct in RPG, or anonymous internal ones.Also, there is always an impedance mismatch expected in json-rpg, due to the fact that an array in json can express different data types, see for example this idea (rejected due to limitations)https://ibm-power-systems.ideas.ibm.com/ideas/IBMI-I-4302
It's not clear what the intent is in defining a result such as you are getting, but, if you can and want to avoid direct parsing via YAJL or similar, you can try stock JSON_TABLE to single out that part, to get you started, src.json is your whole json   "     { "revenueDetails" : [ [..], [..] ] }    "


SELECT
    *
FROM src src, JSON_TABLE(
    src.json,
    '$.revenueDetails[*][*]'
    COLUMNS (
      name               VARCHAR(128)  PATH '$.name',
      description        VARCHAR(256)  PATH '$.description',
      ...
    )
) AS inner
On Wednesday, December 10, 2025 at 02:17:38 PM GMT+1, Jerry Forss <jforss@xxxxxxxxxxxxx> wrote:

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;

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