Generating array of objects in POST request for external API

Hey all! This is something I’ve had a lot of trouble with, hopefully I’m missing something very obvious. I have a page where a user can add wood with a quantity:


The added things are stored in the database (it’s worth noting that the Type field is a self created datatype with two text fields):

My goal is that, when the button “Berekenen” is clicked, it passes these entries as an array of objects in a POST request to my API. Here’s an example of what the array should be like:

Here’s my problem: I can’t for the life of me figure out how to generate an array of objects, based on entries in my database. I’ve seen posts about concatenating lists and passing it on as text to the JSON. Would I need to do that in something like Toolbox? Or would I need to store my data differently in that case? I’ve also tried different JSON plugins like JSONator and JSONtools, but there do not return usable text.

Hope that explains it clearly :slight_smile: Thanks in advance!

You don’t need a plugin.

You can use “format content as text” on your list of objects like this to concatenate JSON objects.

3 Likes