TypebotT
Typebot12mo ago
nefer_l

Understanding Object Parsing in Typebot

Hey all,

I'm having some trouble with handling parsed objects in Typebot and could really use some help. Here's the issue I'm encountering:

I've got a simple experiment where I'm working with an object represented as a string. In my dev console, I can successfully parse the string into an object and test its type – the expected results are as follows:
  1. The string initially returns false for an 'is object' condition.
  2. After parsing it to an object, it returns true for the same condition.
var objectString = `{
  "before":[{"plumbers_id": "000", "result_id": "aaa"},{"plumbers_id": "111", "result_id": "bbb"},{"plumbers_id": "222", "result_id": "ccc"}],
  "during":[{"plumbers_id": "333", "result_id": "ddd"},{"plumbers_id": "444", "result_id": "eee"},{"plumbers_id": "555", "result_id": "fff"}],
  "after":[{"plumbers_id": "666", "result_id": "ggg"},{"plumbers_id": "777", "result_id": "hhh"},{"plumbers_id": "888", "result_id": "iii"}]
}`;
undefined

typeof objectString === 'object' && objectString !== null;
false

objectString = JSON.parse(objectString);
{before: Array(3), during: Array(3), after: Array(3)}

typeof objectString === 'object' && objectString !== null;
true


However, when I try the same experiment within Typebot, the results differ.

After parsing the string and even saving the parsed variable, the second condition test still returns false.

Here's a screencast detailing the steps and where things go wrong: https://www.youtube.com/watch?v=gD6HEFkJrmo

Can anyone provide insights into why the parsed variable isn't being recognized as an object in Typebot even though I'm explicitly saving it as a parsed value?

Do we have to parse it every time we access it, or is there a correct method to save it as an object?

Thanks in advance for any help or guidance!
Screenshot_2025-01-21_at_6.11.16_PM.png
Was this page helpful?