Get words from a text following a pattern

Hello,

I’m new to Knime and I find it awesome!

I’m struggling to get words from a cell that follow a pattern.

The cell text is as follows:

{“filters”: [{“key”: “andOr”, “value”: “AND”, “typeMatch”: “AND_OR”}, {“key”: “fromDate”, “value”: “1581408000000”, “typeMatch”: “EQUAL”}, {“key”: “untilDate”, “value”: “1581408300000”, “typeMatch”: “EQUAL”}]}

I want to get into three different cells and columns following result:

newCol1 | newCol2 | newCol3
andOr | fromDate | untilDate

As you can see, the three words have the following pattern: they are the words between quotes that follow the substring ““key”:”.

Any suggestion how to solve this?

Thank you!!!

Hello @jquadrada,

and welcome to KNIME Community!

Considering you have JSON structure you can simply use JSON Path node with following path:

$.filters[*].key

to obtain all “key” values. Choose output column as String and check List option within node configuration. Follow it with Split Collection Column node to have every value in separate column. In case your starting column is of String type use String to JSON node to convert it to JSON to be able to use above approach.

Br,
Ivan

7 Likes

WOW! This is an amazing top reply!!!

Thank you very much!

1 Like

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