-1

I have data in one of my table columns as like {x:1,y:2} . I wanted to cast the data to json like {"x":"1","y":"2"}

I tried to use JSON_QUOTE and cast as JSON with no success.

Pvria Ansari
  • 406
  • 4
  • 20

1 Answers1

-1

I used this Replace section for the answer:

REPLACE(CONCAT("{\"",REPLACE(REPLACE(REPLACE(REPLACE(form_field.settings,"\n",","),"=",":") ,",","\",\""),":","\":\""),"\"}"),",\"\"","")

then I completed that Like:

JSON_EXTRACT(CAST(REPLACE(CONCAT("{\"",REPLACE(REPLACE(REPLACE(REPLACE(form_field.settings,"\n",","),"=",":") ,",","\",\""),":","\":\""),"\"}"),",\"\"","") AS JSON),"$.accessname" )
Pvria Ansari
  • 406
  • 4
  • 20