I am trying to load JSON data from Kafka into Clickhouse where the JSON contains some escape sequences. E.g:
:) SELECT JSONExtractRaw('{"message": "Hello \"to\" you!"}', 'message')
SELECT JSONExtractRaw('{"message": "Hello "to" you!"}', 'message')
┌─JSONExtractRaw('{"message": "Hello "to" you!"}', 'message')─┐
│ "Hello " │
└─────────────────────────────────────────────────────────────┘
It appears that prior to calling JSONExtractRaw, the input strings are unescaped, which produces invalid JSON. The unescaping seems to be reproducible with this minimal example:
:) SELECT 'Hello \"there\"'
SELECT 'Hello "there"'
┌─'Hello "there"'─┐
│ Hello "there" │
└─────────────────┘
I am wondering if it's possible to retain the original (escaped) representation of the input.
Thank you!