Skip to content

Query Result Format to JSON in Oracle NoSQL Database #152

Answered by dario-vega
otaviojava asked this question in Q&A
Discussion options

You must be logged in to vote

Query examples

You can use the Array and Map Constructors (documented here)

select id, entity,
{
   "name":database.content.name , 
   "city":database.content.city
} as content  
from database WHERE database.entity= 'person'

More powerful transformations can be done using Sequence Transform Expressions (documented here)

select id, entity, 
seq_transform (
        database.content, 
       {"name":$.name, "city":$.city}
) as content 
from database WHERE database.entity= 'person'

Example of output

Original value

{
  "id" : "1",
  "entity" : "person",
  "content" : {
    "city" : "paris",
    "name" : "dario",
    "age" : 50
  }
}

New value (using the constructor or the transform)

{
  "i…

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@dario-vega
Comment options

@otaviojava
Comment options

Answer selected by otaviojava
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
2 participants