https://linen.dev logo
#plugins-general
Title
# plugins-general
j

jo_pearson

02/03/2022, 4:17 PM
Hi everyone! @edward_ryan and I are running into some trouble getting json objects from tap-shipstation to de-nest correctly. Any thoughts or suggestions would be appreciated! The Address and ordersItem objects are defined like this in the shipments.json schema:
Copy code
{
  "type": ["null", "object"],
  "additionalProperties": false,
  "definitions": {
    "Address": {
      "type": ["null", "object"],
      "properties": {
        "name": { "type": ["null", "string"] },
        "company": { "type": ["null", "string"] },
        "street1": { "type": ["null", "string"] },
        "street2": { "type": ["null", "string"] },
        "street3": { "type": ["null", "string"] },
        "city": { "type": ["null", "string"] },
        "state": { "type": ["null", "string"] },
        "postalCode": { "type": ["null", "string"] },
        "country": { "type": ["null", "string"] },
        "phone": { "type": ["null", "string"] },
        "residential": { "type": ["null", "boolean"] },
        "addressVerified": { "type": ["null", "string"] }
      }
    },
     "OrderItem": {
      "type": ["null", "object"],
      "properties": {
        "orderItemId": { "type": ["null", "integer"] },
        "lineItemKey": { "type": ["null", "string"] },
        "sku": { "type": ["null", "string"] },
        "name": { "type": ["null", "string"] },
        "imageUrl": { "type": ["null", "string"] },
        "weight": { "$ref": "#/definitions/Weight" },
        "quantity": { "type": ["null", "integer"] },
        "unitPrice": { "type": ["null", "number"] },
        "taxAmount": { "type": ["null", "number"] },
        "shippingAmount": { "type": ["null", "number"] },
        "warehouseLocation": { "type": ["null", "string"] },
        "options": {
          "type": ["null", "array"],
          "items": { "$ref": "#/definitions/ItemOption" }
        },
        "productId": { "type": ["null", "integer"] },
        "fulfillmentSku": { "type": ["null", "string"] },
        "adjustment": { "type": ["null", "boolean"] },
        "upc": { "type": ["null", "string"] },
        "createDate": { "type": ["null", "string"] },
        "modifyDate": { "type": ["null", "string"] }
      }
    },
And they are referenced like this at the bottom of the file:
Copy code
"properties": {
    "billTo": { "$ref": "#/definitions/Address" },
    "shipTo": { "$ref": "#/definitions/Address" },
    "items": {
      "type": ["null", "array"],
      "items": { "$ref": "#/definitions/OrderItem" }
    },
Both objects flatten correctly in target-redshift pipelinewise, but only the address object flattens in target postgres pipelinewise.