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

4 Replies
Someone will reply to you shortly. In the meantime, this might help:
-# This post was marked as solved by Baptiste. View answer.
Heya nefer,
Hmm, after reproducing your case, I indeed run into the same issue, where the type of the object remains string, despite explicitly parsing it as JSON when overwriting the variable's value.
My first guess was that it was not properly taking into account the new value of the same variable, so I saved the parsed object in a new variable (named differently), but its typeof still returned
string
, so it doesn't come from that.
I even tried several things to explicitly turn it into an object (like the line below), but it STILL returns it as a string, which is odd.
Object.fromEntries(Object.entries(JSON.parse({{obj}})))
I'm guessing you're doing that in the first place because you'll receive the response from an API as a string and need to convert it to JSON within Typebot? Or is it for another use case?Thanks for looking into this, @Anthony. It would be nice to save a JSON object as a Typebot variable instead of parsing it every time.
You're right. I'm doing a GET request from my database and need to parse a JSON object that's a string so I can execute an operation on it in Typebot and then do a PATCH request back to my database.
Found the answer: https://docs.typebot.io/editor/variables#valid-value-types
TL;DR: Variables content can either be a text (string) or a list of texts (string[]).
Typebot Docs
Variables - Typebot Docs
