Skip to main content

Hello!

I am creating a zapier integration for our invoicing software. I am however not sure how can I create a nest an array of JSON objects inside a jSON.

"invoice": {
"seller_name": "name1",
"seller_tax_no": "123456789",
"buyer_name": "name2",
"buyer_email": "some@email.com",
"buyer_tax_no": "987654321",
"positions":[
{"name":"Product 1", "tax":23, "total_price_gross":10.23, "quantity":1},
{"name":"Product 2", "tax":0, "total_price_gross":50, "quantity":3}
]
}

I have no problem adding fields, I am however stumped with “positions”. I have tried making it a Line Group Item, but when I tried inputting some test data I realized it gets turned into a regular array of strings, rather than an array of JSON objects.

"positions": s
"name: product 1",
"vat: 23",
"total_price_gross: 100",
"quantity: 1"
]

Is it possible to make it work in either zapier developer platform, or zapier CLI?

I’m also not sure exactly how Group Line Items work. Can I create multiples of them in one action? I can see no such option in Inptut Designer, so maybe there’s a better way to input a group of values like invoice positions, that varies in size from object to object

@Jakub Ziolkowski - Here’s how to define a nested array of objects in input fields. (In a CLI app).

 


After trying your suggestion, I can see that this is what is actually exported as Line Item Group from CLI. I am looking for a solution that will allow me to add multiple objects, each of them having same four fields, nested under “positions” field in an array. Is that possible in Zapier?

While searching I’ve also found this issue, made back in 2017. Looks like it’s exactly what I need, but it seems to not be possible currently.


Hello, and thank you for your replies!

@ForYourIT I am not creating a Zap here, I believe it’s called Zapier integration, or Zapier App, based on documentation. I want this to be available to use in a Zap :)

I want to create something like I showed in the example, an “invoice” JSON object, with a field “positions”, which is an array of JSON objects each containing the same set of fields

As I wrote I tried creating a Group Line Item, but it creates a simple array rather an array of JSON objects, which makes me wonder what happens with fields I defined in Group Line Item?

 

@ikbelkirasan Thank yo for suggestion, I wil try building an app in Zapier CLI


@Jakub Ziolkowski - Here’s how to define a nested array of objects in input fields. (In a CLI app).

 


Hi there @Jakub Ziolkowski ,

Great question, but to help you out could you provide some more information? Like;

  • What kind of Zap actions are you currently using? Are you using a Javascript code step, what is the code?
  • What is your final goal here? Can you give an example to make it clear
  • What have you tried so far?

Objects in javascript can normally be retrieved with object.nestedobject. But like stated above we need to know your current information.

Thank you!

~Bjorn