Home > Mobile >  Parsing a single quotes json string clickhouse
Parsing a single quotes json string clickhouse

Time:03-29

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

CodePudding user response:

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'
)
  • Related