Legacy Dev Forum Posts

 View Only

Sign Up

How to display nested arrays in an output contract

  • 1.  How to display nested arrays in an output contract

    Posted 06-05-2025 18:44

    JerrySileonsileo80 | 2023-06-22 13:59:15 UTC | #1

    Hi All,

    when I try to get the output based on ANI in a data action I mostly succeed when it's object orientated. But as soon it comes to nested arrays I get to most weird errors.

    "results.keyring.customer_id": [ [ "7112304016", "0186274793", "20182962386" ] ]

    this is my output contract:

    {
      "title": "Output",
      "type": "object",
      "properties": {
        "results": {
          "type": "array",
          "items": {
            "title": "contact",
            "type": "object",
            "properties": {
              "keyring": {
                "type": "array",
                "items": {
                  "title": "customer_id",
                  "type": "string"
                }
              }
            },
            "additionalProperties": true
          }
        }
      },
      "additionalProperties": true
    }

    I want it to work with below output contract as well but if that's not possible than i will do it in two steps to get the data to be used in architect.

    {
      "title": "Output",
      "type": "object",
      "properties": {
        "results": {
          "type": "array",
          "items": {
            "title": "contact ",
            "type": "object",
            "properties": {
              "address": {
                "type": "object",
                "properties": {
                  "street_name": {
                    "type": "string"
                  },
                  "zip_code": {
                    "type": "string"
                  },
                  "country": {
                    "type": "string"
                  },
                  "city": {
                    "type": "string"
                  },
                  "house_number": {
                    "type": "string"
                  }
                },
                "additionalProperties": true
              },
              "contact_phone_number": {
                "type": "string"
              },
              "date_updated": {
                "type": "string"
              },
              "limited_legal_acting": {
                "type": "boolean"
              },
              "initials": {
                "type": "string"
              },
              "contact_email_address": {
                "type": "string"
              },
              "business_type": {
                "type": "string"
              },
              "source_system": {
                "type": "string"
              },
              "gender": {
                "type": "string"
              },
              "last_name": {
                "type": "string"
              },
              "customer_status": {
                "type": "string"
              },
              "date_of_birth": {
                "type": "string"
              },
              "type": {
                "type": "string"
              },
              "customer_id": {
                "type": "string"
              },
              "kvk_sync_available": {
                "type": "boolean"
              }
            },
            "additionalProperties": true
          }
        }
      },
      "additionalProperties": true
    }

    any help is much appriciated

    Best regards Jerry


    Jason_Mathison | 2023-06-22 14:03:03 UTC | #2

    Sending nested arrays to architect is definitely problematic. Data actions "flatten" the results that go to architect into key/value pairs, which isn't compatible with nested arrays.

    Generally we would suggest moving from nested arrays into a single array.

    --Jason


    system | 2023-07-23 14:03:04 UTC | #3

    This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.


    This post was migrated from the old Developer Forum.

    ref: 20564