Is there a way to defermine that column is a JSON_OBJECT
I got a resultset, and some columns might be a JSON_OBJECT. Is there a way (based on metadata) to determine that the column was formed from JSON_OBJECT function?
set rs = ##class(%SQL.Statement).%ExecDirect(,"SELECT 1 colA, JSON_OBJECT('id':1) col2")
do rs.%Display()
I do not want to try parsing json.
I didn't meet that.
Basically it's %String or a %Stream based on size.
I'd suggest having a private data type.
This allows you also to have all tricky LogicalToODBC, .... under control. (and no MAXLEN for %String)
And mapping it to %ALL or naming it %ZstringJSON or similar makes it public and update-restistant
JSON_OBJECT would produce %String still.
Got you!
Something like $isJSON() ? like $isobject() or $listvalid()
select *,
case when a is JSON then 1 else 0 end aa,
case when b is JSON then 1 else 0 end bb,
case when c is JSON then 1 else 0 end cc
from (SELECT 1 a, JSON_OBJECT('id':1) b, '{"id":1}' c)
Great stuff @Vitaliy.Serdtsev
https://docs.intersystems.com/iris20192/csp/docbook/Doc.View.cls?KEY=RSQL_json
everlasting learning!