Date & Time cannot recognize item when name contain "@" character

Describe the problem/error/question

I’m trying convert timestamp I got from Elasticsearch to Unix time format. However, the item name of this timestamp is “@timestamp”, and this is causing n8n not able to recognize this item and showing [ERROR: invalid syntax] error.

I have tried copying the actual timestamp value as an input, and it works. That’s why I believe this is due to the “@” character in the field name instead of the actual value.

Using item name:

Using actual value:

Hi @BeStill, welcome to the community!

I am sorry you’re having trouble. You’re quite right here, the dot notation $json._source.@timestamp will fail because of the @ character. You should, however, be able to make this work by manually setting an expression using the bracket notation. Like this:

{{ $json['_source']['@timestamp'] }}

This is explained in more detail here for example, though ideally n8n would handle this automatically for field names like yours. I’ll make sure to add this to our internal list of improvement ideas.

Let me know if you’re still running into trouble after updating your expression as suggested above :slight_smile:

1 Like

Thanks a lot for your information. @MutedJam
Just did the same approach to got it work. But still really appreciate your answer.

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