Skip to Main Content

ORDS, SODA & JSON in the Database

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Generating json, remove whole section when null

Ria_BMay 23 2019 — edited Jun 3 2019

Hi

I'm generating json from relational data. I have some fields that  doesn't appear on all rows. Is it possible to remove the whole section when the data is null?

'productGroup' VALUE

            json_object ('number' VALUE b.PRODUCT_GROUP_ID,

                                'name' VALUE b.PRODUCT_GROUP_NAME ABSENT ON NULL),

With values:

"productGroup": {

"number": 652,

"name": "Läsk"

},

When the values are null i get:

"productGroup": {},

Desired result:

The the whole section should be omitted.

Thanks and best regards

Ria_B

Comments
Post Details
Added on May 23 2019
4 comments
10,259 views