You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@calcite.apache.org by "Mans Singh (Jira)" <ji...@apache.org> on 2022/01/18 21:16:00 UTC

[jira] [Created] (CALCITE-4989) Nested JSON_OBJECT creation does not produce proper json

Mans Singh created CALCITE-4989:
-----------------------------------

             Summary: Nested JSON_OBJECT creation does not produce proper json
                 Key: CALCITE-4989
                 URL: https://issues.apache.org/jira/browse/CALCITE-4989
             Project: Calcite
          Issue Type: Bug
          Components: core
    Affects Versions: 1.29.0
            Reporter: Mans Singh


I am trying to create a nested json object using JSON_OBJECT and am getting a json with escaped quotes.  
 
I have the following query in sql line :
 
`select JSON_OBJECT(
    KEY 'level1' 
    VALUE(
        JSON_OBJECT(
            KEY 'level2' 
            VALUE(
                 JSON_OBJECT(
                      KEY 'level3' 
                      VALUE 'val3')
                 )
             )
         ) 
      ) 
from (values ('\{"a":{"b":2}}')) t(v);`
And it produces the result:
 
+-------------------------------------------------------------+

|                           EXPR$0                            |

+-------------------------------------------------------------+

| \{"level1":"{\"level2\":\"{\\\"level3\\\":\\\"val3\\\"}\"}"} |
+-------------------------------------------------------------+
 
Also, see https://github.com/zabetak/calcite/commit/988c13ce1ff551d6e4046a3c027ff298f79971f8



--
This message was sent by Atlassian Jira
(v8.20.1#820001)