Replacing / adding text with JSON data

Hi,

I have a call service node which is fed a msg and I can extract the entity_id from that payload in the data using:

{
    "entity_id": "{{payload.entity_id}}",
    "option": "Faulted"
}

This works fine and the result is for example… “entity_id”: “binary_sensor.front_door”

What I would like to do is manipulate the payload.entity_id text coming from {{payload.entity_id}}. I’d like to replace the text ‘binary_sensor’ with ‘select’ (like a find and replace action) and append ‘_bypass_mode’ to the end of the text, so ‘binary_sensor.front_door’ becomes ‘select.front_door_bypass_mode’.

I can append the text at the end fine with the below giving me ‘binary_sensor.front_door_bypass_mode’, but how to do a replace/substitution properly on the string binary_sensor?

{
    "entity_id": "{{payload.entity_id}}_bypass_mode",
    "option": "Faulted"
}

Make sure the data type of the data field is set to JSONata, J: expression.

{
    "entity_id": $replace(payload.entity_id, "binary_sensor", "select") & "_bypass_mode"
}

Thanks so much, that of course works perfectly. I think the penny finally just dropped what the two are between JSON and JSONata. Can all the functions documented here be used in the nodes? JSONata Documentation · JSONata or it is some limited implementation?