Json object creation

create a json object out of multiple objects

  • I need to query multiple records from Airtalbe (different tables) and construct a json object which suites a Contentful content type.
    Therefore I request the values and use a JSON create module to transform the values from Airtable to a JSON object.

from Airtable I receive 3 values from different requests (searches)

primary text
table (escaped json string)
ingredients

Now, with the json create module I want to create a json object including those 3 attribues.

{
  "primary_text" : "ptext value",
  "table" : {
                   "headers" : ["a","b","c"],
                    "rows" : [ ......]
                 },
  "ingredients" : "salt, ..."
}

When creating the JSON create structure, I can not find a suiting data type for the table field which is a json object.

Here is an example json create input with the resulting output

This creates the following output:
jsoncreate_output

When I pass this result on to contentful - create entry it is rejected with the error the value type is supposed to be “object”.

Any ideas how I can create a json object and use it as input for a contentful create entry module?

Hi @Franz_Haupt,

I’m not 100% sure on this but I’ll suggest it anyway…

Looks like your table object should be a collection.
When it comes time to populate that table field, I think you can use the Transform object to JSON module then pop that result into the table field.

2 Likes