arraysjsonquickbase

Quickbase pipeline connected to webhook JSON will not import mixed array


Using pipelines, the listener is working and the JSON is coming in from the website (webhook). I'm able to map all the other fields, but it keeps skipping the 'items name' text field without any error messages.

The array looks like this (trying to get "Sample Item" back:

{
  "create_time": "2015-09-25T23:14:14Z",
  "event_type": "INVOICING.INVOICE.PAID",
  "event_version": "1.0",
  "id": "XXXXXXXX",
  "resource": {
    "billing_info": [
      {
        "business_name": "Test Company",
        "email": "example@example.com",
        "language": "en_US"
      }
    ],
    "id": "INV2-XXXX-XXXX-XXXX-XXXX",
    "invoice_date": "2015-09-28 PDT",
    "items": [
      {
        "name": "Sample Item",
        "quantity": 1,
        "unit_of_measure": "QUANTITY",
        "unit_price": {
          "currency": "USD",
          "value": "1.00"
        }
      }
    ],
    "total_amount": {
      "currency": "USD",
      "value": "1.00"
    }
  },
  "resource_type": "invoices",
  "summary": "An invoice was created"
}

My code in pipelines is {{a.body_params.resource.items[0].name}}

The code format will work fine for other arrays and other fields in the JSON, it's only this object that won't import and skip. My conclusion is it has to do with it being mixed with text and numbers?


Solution

  • "items" is a dict object so needs to be accessed with brackets instead of dot notation.

    {{a.body_params.resource['items'][0].name}}