I have a JSON string in a column, for e.g. [{'id': 2746, 'name': "HaZore'a", 'lat': Decimal('32.644516'), 'lon': Decimal('35.11918')}] of my RS table. My requirement is to remove this single quote from the name value (HaZore'a) and then replace all the single quotes with double quotes and also remove the square brackets since JSON only recognizes double quotes. I tried doing this
replace(replace(left(right((replace(replace(city, '\'', '"'), 'None', '"None"')),
len((replace(replace(city, '\'', '"'), 'None', '"None"'))) - 1),
len((replace(replace(city, '\'', '"'), 'None', '"None"'))) - 2), '\'',
'"'), 'Decimal(', ''), ')', '')
However it leaves me with a double quote in the name value like this {"id": 2746, "name": "HaZore"a", "lat": "32.644516", "lon": "35.11918"}.
How should I update my above statement to eliminate that apostrophe from the name value in the column. I have several rows where the name value has apostrophes.
Please help.
Thanks Ajinkya