Best answer

How to create input fields for complex json objects?

  • 6 April 2021
  • 1 reply
  • 967 views

Hi,

I am new to zapier. I am trying to create an Action in which I want to take different inputs which are part of my API. I am able to add flat structure inputs (like: name:{}, age:{} ...). But I am facing problem to create input fields for complex json formats like:

“items”: [
    {
        "number": "1",
        "quantity": 1,
        "amount": 100,
        "taxCode": "PS081282",
        "itemCode": "Y0001",
        "description": "Yarn"
    }
],

"addresses": {
    "currentAddress": {
        "line1": "1-224, min street",
        "city": "Irvine",
        "region": "CA",
        "country": "US",
        "postalCode": "55423"
    }
}

 

Please help me to know how I can create input fields for “items” and “addresses”.

icon

Best answer by Zane 6 April 2021, 22:54

View original

This post has been closed for comments. Please create a new post if you need help or have a question about this topic.

1 reply

Userlevel 7
Badge +9

You can use the children array to create “line items” if your users will be mapping in data that will be passed in as an array from a trigger step or a subsequent action.  For your ‘items’ object this seems like a rational approach.  https://zapier.github.io/zapier-platform-schema/build/schema.html#fieldschema

If you wanted to have a user explicitly map zero-or-many, discrete, complex objects - say if the input bundle had two named address objects - there’s not a great way to do this today unfortunately.

The other option is to explicitly create the input fields as a “flat set” and then shape that data how your API expects it, in code, before Zapier posts it.  Probably the best approach for your address object.  

Hopefully that made sense.  If not let us know and we can point you to some examples to better illustrate.