cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

How to create an action output schema for array of array or string

fsantaana
Deputy Chef II
Deputy Chef II

I have a custom connector which I am creating a output field schema for.

The HTTP response is JSON in the following format:

{
  Key: [
    [
      "string",
      "string2",
      "..."
     ]
    ],
  Key2: "String",
  Key3: "integer",
}


Here is a sample:

{... 
"user_usage": [
      [
        "user-agent",
        "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/104.0.5112.81 Safari/537.36 Edg/104.0.1293.54"
      ],
      [
        "user-agent",
        "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/104.0.0.0 Safari/537.36"
      ],
  ],
"server_name": "THIS IS A SERVER",
...
}

 How do I create the field definition schema for this Nested Array of a Nested Array? I've tried the below schema but it doesn't seem to work correctly. Looking through the docs, it seems to only accept a nested object for array "of" and not a nested array. 

          {
            name:"user_usage",
            type: "array",
            of: "object",
            properties:[
              {
                type:"array",
                of: "string"
              }
            ]  
          },

 

1 ACCEPTED SOLUTION

gary1
Executive Chef III
Executive Chef III

I got this to work for me in a recipe (not in the SDK):

[
  {
    "name": "outer_array",
    "type": "array",
    "optional": false,
    "properties": [
      {
        "name": "array",
        "type": "array",
        "of": "string",
        "control_type": "text",
        "label": "Array"
      }
    ],
    "of": "object",
    "label": "Outer array"
  }
]

It's weird that the outer array is "of object", but it seems to be correct.

View solution in original post

2 REPLIES 2

gary1
Executive Chef III
Executive Chef III

I got this to work for me in a recipe (not in the SDK):

[
  {
    "name": "outer_array",
    "type": "array",
    "optional": false,
    "properties": [
      {
        "name": "array",
        "type": "array",
        "of": "string",
        "control_type": "text",
        "label": "Array"
      }
    ],
    "of": "object",
    "label": "Outer array"
  }
]

It's weird that the outer array is "of object", but it seems to be correct.

Thanks this worked!