OH3 - Multiple Transformations in HTTP binding channels (JSONPATH + REGEXP?)

Hi!

Is there a possibility to join transformations in HTTP binding-channel-stateTransformation?
I need to parse a Json and then remove " from the resulting value - like fetching the value via JSONPATH and then applying a REGEXP to the result.
It may also work with only a regexp but I consider this as bad style tbh.
If not, what would be the preferred way to do this? What I want to avoid is to have a lot of specialized JS.

Thanks,
Alex.

Would not know how to serialize transformations on a channel, but in a rule you can.

Look in the documentation: HTTP - Bindings | openHAB

Blockquote
Transformations can be chained by separating them with the mathematical intersection character “∩”. Please note that the values will be discarded if one transformation fails (e.g. REGEX did not match).

transform1:pattern∩transform2:pattern

3 Likes

Thanks a lot! How could I have overlooked this strangeness?! And how to add this char via keyboard ?-)

I also was not aware, that the syntax is JSONPATH:
 I only saw JSONPATH(
) in the docu up to now.

So with this I even do not need an additional regex as the result seems to be parsed correctly to a number value.

ALT + 8745

In case you know how the character is called there are UTF-8 etc. tables available where you can get the keycode from. Then use ALT key as described by denominator.
Alternatively search for the character and do copy/paste to get and insert the character.

I think the character is in the description, so using the UI you can easily copy&paste.

I tried this, but it did not work for me.
During my tests I got “)” in notepad++, OH3 Thing Code editor, Google Chrome’s address line and this comment editor window.
And Windows’ Character Map program says its code is U+2229: Intersection.

Yes, it is. I suppose this is the best way to add it to the field.

1 Like