MQTT The Written command different from the read one

Hi all,
I’m configuring an MQTT Generic Thing but I have a problem.
The read value format is different from the value to write. Let me explain.

From the topic I read a Json and the value is

“wwcircmode”: “1x3”
or
“wwcircmode”: “2x3”
or
“wwcircmode”: “3x3”

“wwcircmode”: “6x3”

When I have to write I need to write in a different mode: The 1x3 it will be 1 the 2x3 it will be and so on.
So this mean the value to write is different from the read one!

How can I do this kind of mapping?

Many thanks
Ale

Are you using a Sting channel and item

Hi yes I’m using a string.
I was thinking also to create my transformation function but I have not idea if it’s the best approach.

Thanks