You can translate the question and the replies:

Json format issue while accessing through REST webservice with SQL having Double Quotes(") character

Here are the steps we tried and we are hitting with JSON format issue in output while accessing REST webservice on Denodo derived view. ** Can anybody help suggesting on how to get rid of backslash \ character in the output? ** We are looking for output to be displayed in standard JSON format. Step 1 : We have created a derived view 'dv_test' from below VQL query in Denodo 6.0. select '{"key":"land", "title":{"en":"land"}}' AS asset_type from dual Step 2: Deployed & Published a webservice on 'dv_test' derived view. Step 3: Here is the JSON Output format issue we are facing i.e. Escape character \ before Double quotes(") character { "name": "dv_test", "elements": [ { "asset_type": "{\"key\":\"land\", \"title\":{\"en\":\"land\"}}" } ], "links": [ { "rel": "self", "href": "http://localhost:9090/server/demo_db/ws_dv_test1/views/dv_test?$format=json" } ] } Thanks, Srujan.
31-12-2018 00:54:55 -0500

3 Answers

Hello, By looking at your issue, I would like to clarify the key-value representation in JSON format. JSON is a format where both key and value will be surrounded by **straight double quotes**, so if you try to have **straight double quote** in key or value, it automatically parses the **straight double quote** present inside value or key, with escape characters ( **\** ). To avoid this escape character, I would use **curly** or **typographic double quotes** (** “ ”** ). Hope this helps!
Denodo Team
31-12-2018 04:55:52 -0500
Thank you Denodo Team for the help. It helped. We still have a issue while displaying in JSON format because asset_type stored as String type. So please help us with solution of converting the string asset_type to JSON format so that webservice output format will be properly displayed as JSON. Regards, Srujan.
01-01-2019 09:51:56 -0500
Hello, I was able to achieve your scenario by performing below steps 1. Create a **JSON data source** with the following configuration * Data route: From Variable 1. While creating the base view, assign the asset_type value to the variable. On publishing this view as a rest web service, I would get the assetype value in JSON value. Have a look at [JSON Data Source]( of the Virtual DataPort Administration Guide for more information. Hope this helps!
Denodo Team
09-01-2019 23:11:17 -0500
You must sign in to add an answer. If you do not have an account, you can register here