Query Result Format to JSON in Oracle NoSQL Database #152
-
Hello, I'm using the Oracle NoSQL Database, and I have a question regarding the format of query results. I have a table structure as follows: CREATE TABLE if not exists database (id STRING, entity STRING, content JSON, primary key (id)) When I execute a query like this: select id, entity, database.content.name , database.content.city from database WHERE database.entity= 'person' The query results return correctly, but I'd like to receive them in a JSON format. This way, I can select which fields should be included in the JSON object. I'm wondering if a function or method is available in the Oracle NoSQL Database that would allow me to format the query results as JSON. For instance, something like: select id, entity, JSON(database.content.name , database.content.city) as field_name from database WHERE database.entity= 'person' I'd appreciate any insights or guidance on how to achieve this JSON formatting of query results in the Oracle NoSQL Database. Thank you! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
Query examplesYou can use the Array and Map Constructors (documented here)
More powerful transformations can be done using Sequence Transform Expressions (documented here)
Example of outputOriginal value
New value (using the constructor or the transform)
|
Beta Was this translation helpful? Give feedback.
Query examples
You can use the Array and Map Constructors (documented here)
More powerful transformations can be done using Sequence Transform Expressions (documented here)
Example of output
Original value
New value (using the constructor or the transform)