Example: Constructing JSON

Hey @dgudkov -
Related but perhaps off topic.

I just wanted to open this up to see if others have a tough time with this. I struggle with “Constructing” the JSON files more than anything, especially when it has depth to it. Here is an example:

Again, I’ve been recently working on Magento so I’ll keep it relevant to that:
https://devdocs.magento.com/swagger/#/salesInvoiceRepositoryV1/salesInvoiceRepositoryV1SavePost

In this example if you want to invoice the customer you need to define the product(s) and their qty’s in
POST /V1/invoices/

So the post is potentially different between each sales order based on the number of lines the sales order has. In this case the business user & ERP know that this order has (3) lines and its fully invoiced, but the next order only has (2) lines so if we know that information in a flat file, constructing it in JSON to me is a bit tricky.