Sietze
Sietze

Reputation: 33

Is it possible to prevent ORDS from escaping my GeoJSON?

I have a problem with Oracle ORDS escaping my GeoJSON with "

{
"id": 1,
"city": "New York",
"state_abrv": "NY",
"location": "{\"type\":\"Point\",\"coordinates\":[-73.943849, 40.6698]}"
}

In Oracle DB it is stated correctly:

{"type":"Point","coordinates":[-73.943849, 40.6698]}

Need help to figure out why the " are added and how to prevent this from happening

Upvotes: 2

Views: 185

Answers (1)

thatjeffsmith
thatjeffsmith

Reputation: 22457

add this column alias to your restful service handler query for the JSON column

SELECT id,
       jsons "{}jsons" --this one
  FROM table_with_json

Then when ords sees the data for the column, it won't format it as JSON because it already IS json

You can use whatever you want, in your case it should probably be "{}location"

enter image description here

Upvotes: 3

Related Questions