Trying to insert object as string into BigQuery table

This topic was automatically generated from Slack. You can find the original thread here.

Jean : Hi guys. Need some help.
I have a step which is connected to BigQuery. I have 1 column of type STRING and I try to insert an object as a string JSON.stringify(obj)
I tried the following in the BigQuery step > Rows configuration (hsData is stringified):

{"hs_data": "{{steps.continue_if.$return_value.hsData}}", "timestamp": "{{steps.continue_if.$return_value.timestamp}}"}
or
{"hs_data": {{steps.continue_if.$return_value.hsData}}, "timestamp": "{{steps.continue_if.$return_value.timestamp}}"}
or
{"hs_data": '{{steps.continue_if.$return_value.hsData}}', "timestamp": "{{steps.continue_if.$return_value.timestamp}}"}

I just can’t make it work. What is the correct syntax? Thxs in advance

Leo : you can try:

{"hs_data": "{{ JSON.stringify(steps.continue_if.$return_value.hsData)}}", "timestamp": "{{steps.continue_if.$return_value.timestamp}}"}

Or to be more clear, you can wrap the whole value into an expression, for example:

{{ {"hs_data": JSON.stringify(steps.continue_if.$return_value.hsData), "timestamp": steps.continue_if.$return_value.timestamp} }}

Jean : Thanks! What would be the syntax knowing steps.continue_if.$return_value.hsData is already stringified

Leo : ```
{{ {“hs_data”: steps.continue_if.$return_value.hsData, “timestamp”: steps.continue_if.$return_value.timestamp} }}

Jean : Beautiful! It works. Thank you many times