Jb-99
Jb-99

Reputation: 171

Parsing a single quotes json string clickhouse

I have json that needs to be parsed but the problem is that json's string values have a single quotes

{'name': None, 'medium': 'organic', 'source': 'google-play'}

Is there a way to parse this in clickhouse? Thank you

Upvotes: 1

Views: 1469

Answers (1)

Zheng Bowen
Zheng Bowen

Reputation: 419

That's not a single quote JSON, it's only a print format of JSON Dict. But you can do this to convert it into a JSON:

SELECT JSONExtractString(
  replaceAll(
    replaceAll(
      '{''name'': None, ''medium'': ''organic'', ''source'': ''google-play''}', '''', '"'
    ), 'None', 'null'
  ), 'medium'
)

Upvotes: 1

Related Questions