Re: for json path, for json auto
Posted by: leland knight
Date: October 14, 2021 06:09PM

Thank you, thank you!

I was able to make the following work, which is much easier than loading up a class and outputting it as json:

SELECT JSON_ARRAYAGG(JSON_OBJECT(
'id', id,
'account', account,
'token', token,
'scope', scope,
'added', added,
'expires_in', expires_in)) FROM auth;

If anyone else sees this and happens to know of a way to make it work without having to specifying the label along with the value, since I'm always wanting the label to be the same as the value, please feel free to share. I'd really prefer to not have to specify anything but rather just convert the results to JSON automatically... seems like it would be a common ask.

Options: ReplyQuote


Subject
Views
Written By
Posted
1303
October 13, 2021 09:19AM
554
October 13, 2021 10:12AM
Re: for json path, for json auto
397
October 14, 2021 06:09PM
330
October 14, 2021 06:21PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.