The PAYLOAD
column stores a Json stringified value such as:
"{\"key\":{\"subkey\":\"subvalue\"}}"
Running the ksql statement
SELECT EXTRACTJSONFIELD(PAYLOAD, '$.key') AS key FROM my_stream WHERE (key => subkey = 'subvalue');
results to an error. Is there a way to filter so it returns only if subkey
is equal to "subvalue" ?
To get a value from a nested key stored as a json string we specify a complete key's path as $.key.subkey
:
SELECT EXTRACTJSONFIELD(PAYLOAD, '$.key.subkey') AS data_payload FROM my_stream;