Help creating a JSON data structure 🤓

Hello Makers, I’m aiming at creating a JSON string for an API call via an HTTP module.

I’m using a Create JSON module into which I’m feeding fields from previous steps.

This works for simple items, but I’m struggling to wrap me head around the require data structre of an array for a field called “accommodation” below.

Here’s a sample what that should look like:

"accommodation": [
           {
               "externalId":"HPO1",
               "libraryExternalId":"HOTELS",
               "arrivalDate":"2025-09-05",
               "departureDate":"2025-09-06",
               "comment":"A generous breakfast buffet is included"
               
           },

 {
               "externalId":"HPO2",
               "libraryExternalId":"HOTELS",
               "arrivalDate":"2025-09-06",
               "departureDate":"2025-09-07",
               "comment":"Dinner is included"
               
           }
       ],

The input for the accommodaiton field is a JSON string generated by an aggregate to JSON module. Here’s an example:

[
{"comment":"1x DBL (B&B)","externalId":"recRGrW4ugkbvK8T3","arrivalDate":"2025-05-16","departureDate":"2025-05-17","libraryExternalId":"Hotels"},
{"comment":"1x DBL (B&B)","externalId":"rectZqonA40XLxT2C","arrivalDate":"2025-05-17","departureDate":"2025-05-18","libraryExternalId":"Hotels"}
]

What shold the data structure of the Create JSON module look like to suit the input from the Aggregate JSON module?

Create JSON data structure:

Create JSON module configuration:
image

The current setup results in a plain JSON string and API errors with: “JSON parse error: Cannot construct instance of XXXX (although at least one Creator exists): no String-argument constructor/factory method to deserialize from String value”

Thanks for your help!

Instead of a JSON string, I think you actually need the array.

To do this, you can try using the JSON “Parse JSON” module to convert your JSON into an array of accommodations.

For more information, see https://www.make.com/en/integrations/json, and https://www.make.com/en/help/app/json in the help centre.

Hope this helps! Let me know if there are any further questions or issues.

@samliew

P.S.: Investing some effort into the Make Academy will save you lots of time and frustration using Make.

2 Likes

Thanks @samliew, this worked! :slight_smile:

I had to add an Array Aggregator after the Parse JSON to feed it into the Create JSON module.

1 Like