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:
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!