Extract url text string from an object or convert object to a string

I am doing an HTTP request and one of the fields I am receiving is an an object with a url in it.

When I save the object to a google sheet, the cell shows.

How can I extract the actual url from the object before I save it to Google sheets? I tried using splice but it won’t work because it is not a string. Preferably in the JSON expression…

Thank you in advance. I am using the paid version of N8N.

Hi @davidl, how to best approach this will depend on how your data currently looks like. Assuming you have a real JSON object, you can simply reference the url field inside your parent field. The schema would look like so in n8n (with url appearing on its own):


A workflow to insert only the URL could like so:

Only the URL itself would be inserted in this case, as the expression {{ $json['my field'].url }} references the url field inside my my field here (rather than just my field):

You can of course also use this example expression outside of the actual Google Sheets node if you want (since you specifically asked about this part), for example in another Set node.

Perhaps you can give this approach a go? If that’s not it, can you confirm how the JSON data you’re sending to your Google Sheet node currently looks like and which version of n8n exactly you are running?

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.