Hello! I’ve been having issues with my JSON record string in my Grist Add Records node. No matter what I try, I keep getting a Configuration Error that says “Make sure the custom expression contains a valid JSON object: [object Object]”. I have used JSONstringify on my form variable, since I believe that’s Javascript, but it doesn’t work. Below is a shortened example of the JSON string I am inputting:
So even though the JSON string seems to be read correctly, I still get the configuration error.
I’m also not certain JSONstringify would be the best solution either, since I have some fields that are multi-select fields, and using JSONstringify turns the data into something like [“Tuesday”,“Wednesday”,“Thursday”,“Friday”] instead of just Tuesday,Wednesday,Thursday,Friday which would not directly import this data into Grist correctly for me as a multi-select.
It seems like you’re encountering issues with the JSON format when using the Grist Add Records action. Let’s address a few key points to help resolve this:
JSON Stringification: When you use JSON.stringify, it converts JavaScript objects into JSON strings. However, if the Grist API expects a specific format, especially for multi-select fields, you may need to adjust how you’re constructing your JSON.
Multi-select Fields: For multi-select fields, if Grist expects a comma-separated string rather than an array, you should join the array into a string. For example, if you have an array of days, you can use .join(",") to convert it into a comma-separated string.
Expression Syntax: Ensure that your expressions are correctly formatted. If you’re using expressions within the Pipedream UI, they should be enclosed in {{ }} and should not include JSON.stringify unless explicitly needed for converting objects to strings.
Here’s how you might adjust your JSON construction:
[
{
"fields": {
"Name": steps.trigger.event.answers[5].answer,
"Date_Request_Submitted": steps.trigger.event.created_at,
"Language": steps.trigger.event.flag,
"MultiSelectField": steps.trigger.event.multiSelectArray.join(",") // Example for multi-select
}
}
]
Steps to Resolve:
Remove JSON.stringify: Try removing JSON.stringify from your expressions unless you need to convert an object to a string. The Pipedream environment should handle most data types correctly.
Join Arrays for Multi-select: If you have fields that require a comma-separated string, use .join(",") on the array.
Validate JSON: Ensure that the JSON structure is valid and matches what Grist expects. You can use online JSON validators to check your JSON format.
Test with Simplified Data: Start with a simplified version of your data to ensure the basic structure works, then gradually add complexity.
If you continue to encounter issues, please provide more details about the specific fields and data types you’re working with, and we can further refine the solution.
I’m a bot powered by Pipedream and GPT-4. I’m still learning, so please double-check my answers and code! Learn how to build your own.
@MB could you try Pi’s suggestion? If it doesn’t work, please reach out to Support - Pipedream and share your Workflow URL you see in your browser. I’d like to take a look at it and see if we need to improve the Grist - Add Records action.